# This script bans users which joins a given channel within 5 seconds
# after getting kicked, for 5 minutes. Made for eggdrop v1.1
# delay before users can join the channel after a kick (in seconds)
set joindelay 5
# the bans will be removed after this delay (in minutes)
set bantime 5
# 0=work on one channel only, 1=multichannel (overrides channel-setting)
set multichannel 0
# the channel you wish this script to work on
set channel "#diablo2.de"
# do not ban users with this flag on the bot
set dontban "o"
# 1=nick&host-specific bans, 0=host-specific bans
set nickban 1
bind kick - * autorejoin_ban
# bind join - * autorejoin_ban
proc autorejoin_ban {nick uhost hand chan knick reason} {
global joindelay channel multichannel
if {![expr [lsearch -glob [utimers] "*nada $knick $chan*"] + 1]} {
if {$multichannel} {
utimer $joindelay [subst {kickban_when_autorejoined $knick $chan}]
} else {
if {$chan == $channel} {
utimer $joindelay [subst {kickban_when_autorejoined {$knick} $chan}]
}
}
}
}
proc kickban_when_autorejoined {nick chan} {
global bantime dontban nickban joindelay
if {[onchan $nick $chan]} {
if {[matchattr [nick2hand $nick $chan] $dontban]} {
# putserv "PRIVMSG $chan :$nick will not be banned, of course, as he has +$dontban."
} else {
# hostmasking:
append userhost $nick "!" [getchanhost $nick $chan]
set hostmask [maskhost $userhost]
if {[string first @ $hostmask]<12} {
set hostmask "*!*[string range $hostmask 2 [string length $hostmask]]"
}
# insert nick for nickban:
if {$nickban} { set hostmask "*$nick$hostmask"}
# performance:
putserv "MODE $chan +b $hostmask"
utimer [expr 3 * $joindelay] [subst {nada $nick $chan}]
putserv "KICK $chan $nick :autorejoined after getting kicked. -> lamer!"
if {![expr [lsearch -glob [utimers] "*MODE $chan -b $hostmask*"] + 1]} {
utimer [expr 60 * $bantime] [subst {putserv "MODE $chan -b $hostmask"}]
}
putserv "notice $nick :Somebody kicked you, and you autorejoined. $bantime minutes in the corner! Turn off autorejoin!"
}
}
}
proc nada {nick chan} { }
putlog "NO! autorejoin v1.1c by nickerne"