bind mode * "% +b" check:ban
proc check:ban {nick uhost handle channel change target} {
# check if the mask matches the bot's host and return if it doesn't
if {![string match -nocase $target $::botname]} return
# do what action/actions you wish as the mask matches his host
putserv "PRIVMSG spithash :Yo, I am banned on $channel !!!"
}
The question is, how can I make it inform me if it even gets voiced/devoiced and opped/deopped too?
Thank you, it will be really helpful to me and a piece of cake for you coders
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
bind MODE - * check:mode
proc check:mode {nick uhost handle channel change target} {
if {[string equal -nocase $target $::botnick]} {
switch -- $change {
"+o" {putserv "PRIVMSG spithash :Yo, I have been oped by $nick on $channel !!!"}
"-o" {putserv "PRIVMSG spithash :Yo, I have been deoped by $nick on $channel !!!"}
"+v" {putserv "PRIVMSG spithash :Yo, I have been voiced by $nick on $channel !!!"}
"-v" {putserv "PRIVMSG spithash :Yo, I have been devoiced by $nick on $channel !!!"}
default {}
}
} else {
if {([string equal $change "+b"]) && ([string match -nocase $target $::botname])} {
putserv "PRIVMSG spithash :Yo, I have been banned by $nick on $channel !!!"
}
}
return 0
}
The one drawback, if you consider it such, is that coded in this way causes the bot to check every mode change on every channel.
that would work only if there's a single mode change per line (like -v bot), thus you would need (not tested, but in theory) to use lsearch or a foreach loop with a isbotnick check that is basically the same thing with the lsearch instead.
Once the game is over, the king and the pawn go back in the same box.