Hello,
I asked for this script several weeks ago,but now it is a very stringent matter...
Is it possible that whenever someone will message my eggdrop, this will automatically verify the banlist in the channel #channel, and if the inquirer has a match in the banlist to be automatically ignored ?
awyeah wrote:[string match -nocase *$chanban* $uhost]
This has been discussed before. 'string match' doesn't match the way most ircds do and the mask is matched against nick!user@host, so a ban on a nick would never match the way you do it (even if you're lucky and there's no brackets/backslashes screwing up the actual matching.)
oh..and btw: 'msgm' is not triggered if the message is matched by a 'msg' bind iirc.
well,I need this on an Undernet channel.And the banlist is 99% with adresses like this: *!*@numeric.IP or *!*@hostname . Well,is it possible to create a script like this ? And no,I don't know anything about tcl scripting,so if someone can help me,write the whole code
Why not mirror the banlist from the channel in question instead of checking the entire banlist every time your bot recieves a message?
This script should add/remove ignores based on the banlist in #channel (change the variable if your channel's called something else)
set b2i_chan "#channel"
bind raw - 368 b2i:368
bind mode - "$b2i_chan ?b" b2i:mode
proc b2i:368 {f k a} {
scan $a %*s%s c
if {![string eq -noc $c $::b2i_chan]} return
# add new ignores if there's new bans
foreach {m . .} [join [chanbans $c]] {
if {![isignore $m]} {newignore $m b2i b2i}
}
# remove ignores placed by this script that are not in the banlist
foreach {m r . . h} [join [ignorelist]] {
if {$r=="b2i"&&$h=="b2i"&&![ischanban $m $c]} {killignore $m}
}
}
proc b2i:mode {n u h c m b} {
if {$m=="+b"} {# add ignore
if {![isignore $b]} {newignore $b b2i b2i}
} else {# remove if ignored by this script
if {[isignore $b]} {
foreach {m r . . h} [join [ignorelist]] {
if {$b==$m&&$r=="b2i"&&$h=="b2i"} {killignore $b; break}
}
}
}
}
When loading the script for the first time you can force the bot to update the ignore list by doing ".dump MODE #channel +b" on your partyline.
(edit: changed a variable name (twice ))
Last edited by user on Wed Oct 27, 2004 5:25 pm, edited 2 times in total.
Currently ignoring:
[ 1] +b (expires at 22:25)
b2i: b2i
Started 22:10
it was due to a bug which is fixed (i edited the post)
load the new script and do .dump MODE #channel +b again
You might also want to make the ignores permanent. (To avoid having ignores removed before the bans are gone) If you want this, change "{newignore $m b2i b2i}" to "{newignore $m b2i b2i 0}" and "{newignore $b b2i b2i}" to "{newignore $b b2i b2i 0}"
(I thought making them non-permanent by default would be a good idea as you might not like the script and if it created alot of ignores, having them expire some time would save you some work removing ignores by hand)
mmm .. now it's a great job thank you !
I have only one last question : what does " .dump MODE #channel +b " make ? I .help dump,visited the URL,but didn't understand a lot.Should I type this command everytime the bot rehashes? Or if I restart it ?
'.dump' sends stuff directly to the server. Doing "MODE #somechan +b" is the way to fetch the banlist of a channel. You should never need to do that again as the bot will take care of it when joining your channel.