aboutsummaryrefslogtreecommitdiff
path: root/saxrobot
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-03-09 12:45:36 +1300
committerDavid Phillips <david@sighup.nz>2017-03-09 12:45:36 +1300
commit67d2dbfe175e71b08dbaccb3e673fe94cf72c7bb (patch)
tree5aab94bff2ca3322472f0b553e6ab085549e5c53 /saxrobot
parent3b19802f18f8b5d48f89768743cfbe854fc9df4f (diff)
parent15bdb198c3736d9db6a6e2eec84296922789fd64 (diff)
downloadidalius-67d2dbfe175e71b08dbaccb3e673fe94cf72c7bb.tar.xz
Merge branch 'more-commands'
Diffstat (limited to 'saxrobot')
-rwxr-xr-xsaxrobot28
1 files changed, 28 insertions, 0 deletions
diff --git a/saxrobot b/saxrobot
index c4dc728..3f6fdd9 100755
--- a/saxrobot
+++ b/saxrobot
@@ -91,6 +91,34 @@ sub irc_msg {
$irc->yield(privmsg => $nick => "I am bot, go away");
return;
}
+ if ($what =~ /^nick\s/) {
+ my ($channel) = $what =~ /^nick\s+(\S+)$/;
+ if ($channel) {
+ $irc->yield(nick => $channel);
+ } else {
+ $irc->yield(privmsg => $nick => "Syntax: nick <nick>");
+ }
+ }
+ if ($what =~ /^part\s/) {
+ my $message;
+ if ($what =~ /^part(\s+(\S+))+$/m) {
+ $what =~ s/^part\s+//;
+ my ($chan_str, $reason) = split /\s+(?!#)/, $what, 2;
+ my @channels = split /\s+/, $chan_str;
+ $irc->yield(part => @channels => $reason);
+ } else {
+ $irc->yield(privmsg => $nick => "Syntax: part <channel1> [channel2 ...] [partmsg]");
+ }
+ }
+ if ($what =~ /^join\s/) {
+ if ($what =~ /^join(\s+(\S+))+$/) {
+ $what =~ s/^join\s+//;
+ my @channels = split /\s+/, $what;
+ $irc->yield(join => $_) for @channels;
+ } else {
+ $irc->yield(privmsg => $nick => "Syntax: join <channel1> [channel2 ...]");
+ }
+ }
if ($what =~ /^say\s/) {
my ($channel, $message) = $what =~ /^say\s+(\S+)\s(.*)$/;
if ($channel and $message) {