3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-24 03:33:06 +01:00

Add support for per-channel bot trigger characters

This commit is contained in:
Pragmatic Software 2015-03-23 04:27:41 -07:00
parent 2e9f15b7e2
commit 44bdf26ebc

View File

@ -69,12 +69,17 @@ sub process_line {
my $cmd_text = $text;
$cmd_text =~ s/^\/me\s+//;
my $bot_trigger = $pbot->{registry}->get_value('general', 'trigger');
# get channel-specific trigger if available
my $bot_trigger = $pbot->{registry}->get_value($from, 'trigger');
if (not defined $bot_trigger) {
$bot_trigger = $pbot->{registry}->get_value('general', 'trigger');
}
if($cmd_text =~ /^$bot_trigger?\s*{\s*(.*)\s*}\s*$/) {
$has_code = $1 if length $1;
$preserve_whitespace = 1;
} elsif($cmd_text =~ /^\Q$bot_trigger\E(.*)$/) {
} elsif($cmd_text =~ /^$bot_trigger(.*)$/) {
$command = $1;
} elsif($cmd_text =~ /^.?$mynick.?\s+(.*?)$/i) {
$command = $1;