This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Old posts that have not been replied to for several years.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Mon Aug 18, 2003 12:45 pm
my spambot relays to the bot whenever some one spams to it like this:
[quote][ma/web] Message from nick (ident@host): <spam message>
I made this script to make the bot kick the spammer (nick)
Code: Select all
set prefixes {
"\[ma/web\]"
"\[ma/inv\]"
"\[ma/net\]"
"\[exp/bd\]"
"\[exp/vrs\]"
}
set chan "#channel"
bind msg f * sb:kick
proc sb:kick {nick uhost hand arg} {
global prefixes chan
if {![botisop $chan]} {return 0}
foreach spam [string tolower $prefixes] {
if {[lindex [split $arg] 0] == $spam} {
putquick "KICK $chan [lindex [split $arg] 3] :$spam any type of spam is not allowed - Banned 10mins."
set sbban "*!*@[lindex [split [getchanhost [lindex [split $arg] 3] $chan] @] 1]"
putquick "MODE $chan +b $sbban"
timer 10 "pushmode $chan -b $sbban"
}
}
}
but it didn't work. any ideas how to fix it ? (no errors appeard in partyline.)
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Mon Aug 18, 2003 12:56 pm
msgm, not msg
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Mon Aug 18, 2003 2:28 pm
thanx
it works now.
but may I ask, what's the difference between msg and msgm ?
and can I make
bind msg f "nick!*@host" sb:kick ? (will it read the hostmask as nick!*@host or should I make it "nick *@host" ?)
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Mon Aug 18, 2003 2:30 pm
how about checking doc/tcl-commands.doc?
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Mon Aug 18, 2003 3:39 pm
MSG
Description: used for /msg commands. The first word of the user's
msg is the command, and everything else becomes the text argument.
Module: server
MSGM
Description: matches the entire line of text from a /msg with the
mask. This is useful for binding Tcl procs to words or phrases
spoken anywhere within a line of text.
Module: server
didn't understand it.
as for the host question, its answer is not in tcl-commands.doc ?
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Mon Aug 18, 2003 11:34 pm
Put simply, MSG matches the first word only, and MSGM matches the whole line. Also, MSG doesn't let you use wildcards.
About your host question... I didn't even understand it heh. What you posted will look for the word nick!*@host, typed like that (no wildcards) and then call sb:kick when somebody types it. Is that what you want?
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Tue Aug 19, 2003 8:59 am
no I meant for example if the +f spambot's nick is SpamSpy.
I make the bind like this:
bind msgm f SpamSpy!*@host sb:kick
or should it be:
bind msgm f "SpamSpy *@host" sb:kick
Note:I only want the SpamSpy to be able to order it, not every +f user.
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Tue Aug 19, 2003 1:31 pm
No you can't do that, just use msgm to bind to * and then check the nick!user@host yourself within the proc. Again, MSG and MSGM match what you *say*, not your nick or your user@host.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Tue Aug 19, 2003 3:01 pm
oh yeah, ur right
I didn't understand what they ment with "mask" in tcl-commands.doc
thanx
so this should work ?
if {$nick!*[string range $uhost [string first "@" $uhost end]] != "nick!*@host"} {return 0}
strikelight
Owner
Posts: 708 Joined: Mon Oct 07, 2002 10:39 am
Contact:
Post
by strikelight » Tue Aug 19, 2003 3:07 pm
Sir_Fz wrote: oh yeah, ur right
I didn't understand what they ment with "mask" in tcl-commands.doc
thanx
so this should work ?
if {$nick!*[string range $uhost [string first "@" $uhost end]] != "nick!*@host"} {return 0}
Should be:
Code: Select all
if {$nick!*[string range $uhost [string first "@" $uhost] end] != "nick!*@host"} {return 0}
(you had a ] in the wrong spot)
Papillon
Owner
Posts: 724 Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no
Post
by Papillon » Tue Aug 19, 2003 3:59 pm
you can also use somthing like:
Code: Select all
if {$nick!*@[lindex [split $uhost @] 1] != "nick!*@host"} {return 0}
Elen sila lúmenn' omentielvo
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Tue Aug 19, 2003 4:32 pm
yeah I noticed that
thank you both
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Tue Aug 19, 2003 4:52 pm
[13:48] Tcl error [sb:kick]: syntax error in expression "$nick!*@[lindex [split $uhost @] 1] != "nick!*@xx.xx.xxx.*"
why's that ?
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Tue Aug 19, 2003 8:16 pm
You forgot spaces around the !=
egghead
Master
Posts: 481 Joined: Mon Oct 29, 2001 8:00 pm
Contact:
Post
by egghead » Tue Aug 19, 2003 8:51 pm
I would set "'s around the $nick!*@[lindex [split $uhost @] 1].
Code: Select all
if { "$nick!*@[lindex [split $uhost @] 1]" != "nick!*@host"} { return 0 }