diff options
author | David Phillips <david@sighup.nz> | 2017-03-09 12:45:36 +1300 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2017-03-09 12:45:36 +1300 |
commit | 67d2dbfe175e71b08dbaccb3e673fe94cf72c7bb (patch) | |
tree | 5aab94bff2ca3322472f0b553e6ab085549e5c53 | |
parent | 3b19802f18f8b5d48f89768743cfbe854fc9df4f (diff) | |
parent | 15bdb198c3736d9db6a6e2eec84296922789fd64 (diff) | |
download | idalius-67d2dbfe175e71b08dbaccb3e673fe94cf72c7bb.tar.xz |
Merge branch 'more-commands'
-rwxr-xr-x | saxrobot | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -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) { |