Add !help command
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 24 Oct 2015 23:17:52 +0000 (00:17 +0100)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 24 Oct 2015 23:17:52 +0000 (00:17 +0100)
lib/App/Statsbot.pm

index 6403bee216e20c66937c8d83a37ba28c2fbc888f..d91020322efc2505ccf92ef89da5b6251fe8e842 100644 (file)
@@ -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;
 
This page took 0.00996 seconds and 4 git commands to generate.