diff options
author | David Phillips <david@sighup.nz> | 2018-08-07 17:37:19 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2018-08-07 17:37:19 +1200 |
commit | 4f1d6488c81320e31addf011145b2379040a87aa (patch) | |
tree | 885f19fa83d9beecd41139c61578047d7061e3d4 | |
parent | 2437a2ae6c64e189b5c6d50525e574c60b08c209 (diff) | |
download | idalius-4f1d6488c81320e31addf011145b2379040a87aa.tar.xz |
Add nick-prefixing for bot
-rw-r--r-- | bot.conf.example | 1 | ||||
-rw-r--r-- | config_file.pm | 1 | ||||
-rwxr-xr-x | idalius.pl | 3 |
3 files changed, 4 insertions, 1 deletions
diff --git a/bot.conf.example b/bot.conf.example index 29b619d..428b5eb 100644 --- a/bot.conf.example +++ b/bot.conf.example @@ -15,6 +15,7 @@ quit_msg = "Goodbye!" user = nobody group = nobody triggers = 'sa+x' => 'π· ', 'trumpet' => 'πΊ ', 'snake' => 'π ' +prefix_nick = 1 prefix = % antiflood_on = 0 diff --git a/config_file.pm b/config_file.pm index bc30cea..01991c7 100644 --- a/config_file.pm +++ b/config_file.pm @@ -24,6 +24,7 @@ sub parse_config 'group', 'url_on', 'url_len', + 'prefix_nick', 'prefix', 'antiflood_on'); my @list_configs = ( @@ -190,7 +190,8 @@ sub irc_public { return if (grep {$_ eq $nick} @{$config{ignore}}); my $stripped_what = strip_color(strip_formatting($what)); - if ($stripped_what =~ s/^$config{prefix}//) { + if ($config{prefix_nick} && $stripped_what =~ s/^\Q$current_nick\E[:,]\s+//g || + $stripped_what =~ s/^$config{prefix}//) { $output = run_command($stripped_what, $who, $where); $irc->yield(privmsg => $where => $output) if $output; strike_add($nick, $channel) if $output; |