From 2242e761b79740056fd4306841c6d548f800e2f0 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Thu, 21 Sep 2017 12:58:59 +1200 Subject: Add action command --- idalius.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'idalius.pl') diff --git a/idalius.pl b/idalius.pl index 9529c67..5b7db29 100755 --- a/idalius.pl +++ b/idalius.pl @@ -139,6 +139,7 @@ sub irc_msg { $irc->yield(privmsg => $nick => "I am bot, go away"); return; } + # FIXME this needs tidying. Some of this can be factored out, surely. if ($what =~ /^nick\s/) { my ($newnick) = $what =~ /^nick\s+(\S+)$/; if ($newnick) { @@ -182,6 +183,15 @@ sub irc_msg { $irc->yield(privmsg => $nick => "Syntax: say "); } } + if ($what =~ /^action\s/) { + my ($channel, $action) = $what =~ /^action\s+(\S+)\s(.*)$/; + if ($channel and $action) { + $irc->yield(ctcp => $channel => "ACTION $action"); + $irc->yield(privmsg => $nick => "Requested."); + } else { + $irc->yield(privmsg => $nick => "Syntax: action "); + } + } if ($what =~ /^reconnect/) { my ($reason) = $what =~ /^reconnect\s+(.+)$/; $irc->yield(privmsg => $nick => "Doing that now"); -- cgit v1.1