From 5013bcc130227bc32086c6da621c0a02051cb1d8 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Tue, 7 Mar 2017 12:22:32 +1300 Subject: Autorejoin immediately on kick --- saxrobot | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'saxrobot') 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]; -- cgit v1.1