From: Marius Gavrilescu Date: Sat, 24 Oct 2015 23:17:52 +0000 (+0100) Subject: Add !help command X-Git-Tag: 0.001001~3 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=410c016e029d80a8a8ce28b04e89a5160b8ebda1;hp=3cdbe25624e004e048af74ae3840af2d5a698e33;p=app-statsbot.git Add !help command --- diff --git a/lib/App/Statsbot.pm b/lib/App/Statsbot.pm index 6403bee..d910203 100644 --- a/lib/App/Statsbot.pm +++ b/lib/App/Statsbot.pm @@ -110,6 +110,14 @@ sub on_fatal{ die "Fatal error: $_[ARG0]" } sub on_public{ my ($targets,$message)=@_[ARG1,ARG2]; my $botnick = $irc->nick_name; + + if ($message =~ /(?:$botnick[:,])?\s*!?help\s*(.*)/) { + $irc->yield("Try !presence username interval [truncate]"); + $irc->yield("For example, !presence mgv '2 days'"); + $irc->yield("or !presence mgv '1 year' 4"); + return; + } + return unless $message =~ /(?:$botnick[:,])?\s*!?presence\s*(.*)/; my ($nick, $time, $truncate) = shellwords $1;