aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-08-07 17:37:19 +1200
committerDavid Phillips <david@sighup.nz>2018-08-07 17:37:19 +1200
commit4f1d6488c81320e31addf011145b2379040a87aa (patch)
tree885f19fa83d9beecd41139c61578047d7061e3d4
parent2437a2ae6c64e189b5c6d50525e574c60b08c209 (diff)
downloadidalius-4f1d6488c81320e31addf011145b2379040a87aa.tar.xz
Add nick-prefixing for bot
-rw-r--r--bot.conf.example1
-rw-r--r--config_file.pm1
-rwxr-xr-xidalius.pl3
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 = (
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;