]> iEval git - app-statsbot.git/blobdiff - lib/App/Statsbot.pm
Send error messages correctly
[app-statsbot.git] / lib / App / Statsbot.pm
index 6403bee216e20c66937c8d83a37ba28c2fbc888f..49fb66fe0dda4aab3bbd5068265caf1c951a7c83 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(privmsg => $targets, "Try !presence username interval [truncate]");
+               $irc->yield(privmsg => $targets, "For example, !presence mgv '2 days'");
+               $irc->yield(privmsg => $targets, "or !presence mgv '1 year' 4");
+               return;
+       }
+
        return unless $message =~ /(?:$botnick[:,])?\s*!?presence\s*(.*)/;
        my ($nick, $time, $truncate) = shellwords $1;
 
@@ -123,7 +131,7 @@ sub on_public{
        eval {
                $time = parse_duration $time;
        } or do {
-               $irc->yield("cannot parse timespec: $time");
+               $irc->yield(privmsg => $targets, "cannot parse timespec: $time");
                return;
        };
 
This page took 0.019086 seconds and 4 git commands to generate.