From 410c016e029d80a8a8ce28b04e89a5160b8ebda1 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sun, 25 Oct 2015 00:17:52 +0100 Subject: [PATCH] Add !help command --- lib/App/Statsbot.pm | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- 2.39.2