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.

Script not working

Old posts that have not been replied to for several years.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Script not working

Post by Sir_Fz »

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.)
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

msgm, not msg
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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 avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

how about checking doc/tcl-commands.doc?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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 ?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

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?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

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.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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}
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

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)
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

you can also use somthing like:

Code: Select all

if {$nick!*@[lindex [split $uhost @] 1] != "nick!*@host"} {return 0}
Elen sila lúmenn' omentielvo
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

yeah I noticed that :)

thank you both :)
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

[13:48] Tcl error [sb:kick]: syntax error in expression "$nick!*@[lindex [split $uhost @] 1] != "nick!*@xx.xx.xxx.*"

why's that ?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

You forgot spaces around the !=
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

I would set "'s around the $nick!*@[lindex [split $uhost @] 1].

Code: Select all

if { "$nick!*@[lindex [split $uhost @] 1]" != "nick!*@host"} { return 0 }
Locked