aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-03-07 12:22:32 +1300
committerDavid Phillips <david@sighup.nz>2017-03-07 12:47:53 +1300
commit5013bcc130227bc32086c6da621c0a02051cb1d8 (patch)
treed3bf7e7c976e64bf147fa0a0e3dbabc697007101
parente1a382c7db700b1dc5a9e3e859f4579367624323 (diff)
downloadidalius-5013bcc130227bc32086c6da621c0a02051cb1d8.tar.xz
Autorejoin immediately on kick
-rwxr-xr-xsaxrobot11
1 files changed, 10 insertions, 1 deletions
diff --git a/saxrobot b/saxrobot
index 3cfa094..da51f8f 100755
--- a/saxrobot
+++ b/saxrobot
@@ -25,7 +25,7 @@ $irc->plugin_add('NickServID', POE::Component::IRC::Plugin::NickServID->new(
POE::Session->create(
package_states => [
- main => [ qw(_default _start irc_001 irc_public irc_msg) ],
+ main => [ qw(_default _start irc_001 irc_kick irc_public irc_msg) ],
],
heap => { irc => $irc },
);
@@ -52,6 +52,15 @@ sub irc_001 {
return;
}
+sub irc_kick {
+ my ($kicker, $channel, $kickee, $reason) = @_[ARG0 .. ARG3];
+ if ($kickee eq $config{nick}) {
+ print "I was kicked by $kicker ($reason). Rejoining now.\n";
+ $irc->yield(join => $channel);
+ }
+ return;
+}
+
sub irc_public {
my ($sender, $who, $where, $what) = @_[SENDER, ARG0 .. ARG2];
my $nick = ( split /!/, $who )[0];