Code: Select all
bind kick - * kick:remove
bind notc - "* logged in as *" check:verify
proc kick:remove {nick uhost hand chan target reason} {
global botnick
if {($target == $botnick)} {
putserv "PRIVMSG X :verify $nick"
}
}
proc check:verify {nick host hand arg dest} {
global botnick
if {[string equal $dest $botnick]} {
foreach i [channels] {
putserv "PRIVMSG X :remuser $i [lindex [split $arg] end]"
}
}
}
#Mind you this might flood your network services, if your bot is
#on alot of channels and it tries to delete alot of access entries.
putlog "Eggdrop remove access if op kicks the bot using /kick #channel kicker"
Also, you will encount problems when the channel is with upper case or something like this and the there will not be a match. So, either make the test lower case like:if {[lsearch -exact $mychans $chan] != -1)} {
# got a match! let's do something..
}
or just use something likeif {[lsearch -exact [string tolower $mychans] [string tolower $chan]] != -1)} {
# got a match! let's do something..
}
if {[string match -nocase "*$chan*" $mychans]} {
# got a match! let's do something..
}
Code: Select all
#Set the channels on which you would like this script active on
set mychannels "#mychan1 #mychan2 #chan3 #chat4"
if {(([lsearch -exact [split [string tolower $mychannels]] [string tolower $chan]] != -1) || ($mychannels == "*"))} {
<-----awyeah wrote:This should be it if I am correct.
I haven't tested it though.
Give it a try and let me know!
You mentioned for the script to work on all channels the bot is onCode: Select all
bind kick - * kick:remove bind notc - "* logged in as *" check:verify proc kick:remove {nick uhost hand chan target reason} { global botnick if {($target == $botnick)} { putserv "PRIVMSG X :verify $nick" } } proc check:verify {nick host hand arg dest} { global botnick if {[string equal $dest $botnick]} { foreach i [channels] { putserv "PRIVMSG X :remuser $i [lindex [split $arg] end]" } } } #Mind you this might flood your network services, if your bot is #on alot of channels and it tries to delete alot of access entries. putlog "Eggdrop remove access if op kicks the bot using /kick #channel kicker"
so it would do this with a loop with for [channels].
You can also convert this script to work on multiple channels the bot is on which you can define, but it would work on only the channels you specify and not on all the channels the bot is on.
Oups.. indeed. Duno at was I was thinking..strikelight wrote:This will cause problems if for example,caesar wrote: if {[string match -nocase "*$chan*" $mychans]} {
# got a match! let's do something..
}
$mychans == "#this #is #my #channel #list"
and
$chan == "#th"
Code: Select all
bind kick - "*" the:x:kick
proc the:x:kick {nick uhost hand chan vict reas} {
if {![isbotnick $vict] || $nick != "X"} {
return
}
set kicker [string trim [lindex [split $reas] 0] {()}]
putquick "PRIVMSG X :remuser $chan $kicker"
}