From 9db303b81197bf72cf28bd3c1cd8e90e58d6ea29 Mon Sep 17 00:00:00 2001 From: Al Beano Date: Mon, 4 Jul 2016 18:41:12 +0100 Subject: [PATCH] config setting for command character --- MarkovBot.pl | 5 +++-- config.default.yml | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/MarkovBot.pl b/MarkovBot.pl index c09e8c2..ea4146c 100644 --- a/MarkovBot.pl +++ b/MarkovBot.pl @@ -17,18 +17,19 @@ use MarkovBot::Commands; sub said { my $self = shift; my $msg = shift; + my $command_char = config "command_character"; # Ignore PMs and ignored users return if $msg->{channel} eq 'msg'; return if isIgnored($msg->{who}); # Intercept commands - if ($msg->{body} =~ m/^\.\w+/) { + if ($msg->{body} =~ m/^$command_char.+/) { my $command = $msg->{body}; my @command = split(" ", $command); my $bare = $command[0]; - $bare =~ s/^\.//; + $bare =~ s/^$command_char//; my %subs = %{getCommandSubs()}; diff --git a/config.default.yml b/config.default.yml index 567dedd..4c980f7 100644 --- a/config.default.yml +++ b/config.default.yml @@ -1,3 +1,8 @@ +# +# General settings +# +command_character: "." + # # Redis Settings #