From 4f1d6488c81320e31addf011145b2379040a87aa Mon Sep 17 00:00:00 2001 From: David Phillips Date: Tue, 7 Aug 2018 17:37:19 +1200 Subject: Add nick-prefixing for bot --- bot.conf.example | 1 + config_file.pm | 1 + idalius.pl | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) 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 = ( diff --git a/idalius.pl b/idalius.pl index a451309..8f99eb1 100755 --- a/idalius.pl +++ b/idalius.pl @@ -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; -- cgit v1.1