| View previous topic :: View next topic |
| Author |
Message |
DJmart Voice
Joined: 08 Mar 2006 Posts: 21
|
Posted: Sat Apr 01, 2006 12:49 pm Post subject: Make this channel specific? |
|
|
| Code: | set badnicks [list "*[censored]*" "*dyn_*" "*dyn_user*"]
bind join - * ban:bnick
bind nick - * ban:bnick
proc ban:bnick {nick uhost hand chan {nn ""}} {
global badnicks
set bbanmask "*!*@[lindex [split $uhost @] 1]"
if {$nn == ""} { set nn $nick }
if {![isbotnick $nick]} {
foreach badnick $badnicks {
if {[string match -nocase $badnick $nn]} {
putserv "MODE $chan +b $bbanmask"
putserv "KICK $chan $nick :Please Identify, before you enter this channel, and or make sure you auto-ident when you disconnect This ban will expire in 15 Minutes ."
break
}
}
}
}
|
Thats the code, yet, I want this to be for user defined channels such as
Channels: "#lamer" "#Smile"
Thanks! |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Sat Apr 01, 2006 4:18 pm Post subject: |
|
|
such a feature has been posted like 30 times.
Edit: http://forum.egghelp.org/search.php _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Last edited by De Kus on Sun Apr 02, 2006 8:40 am; edited 1 time in total |
|
| Back to top |
|
 |
DJmart Voice
Joined: 08 Mar 2006 Posts: 21
|
Posted: Sat Apr 01, 2006 7:52 pm Post subject: |
|
|
could you post it?
I am an uber noob with TCL |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Apr 02, 2006 10:11 am Post subject: |
|
|
You can create a list of channels
| Code: | | set bnchans {#chan1 #chan2} |
and use
| Code: | | if {[lsearch -exact $bnchans $chan] == -1} {return 0} |
inside your proc(s). Here ofcourse, bnchans should be globalized inside the proc and you would want to make the channels lower-case since [lsearch] is case-sensitive. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
DJmart Voice
Joined: 08 Mar 2006 Posts: 21
|
Posted: Sun Apr 02, 2006 11:15 am Post subject: |
|
|
| Code: | set badnicks [list "*[censored]*" "*dyn_*" "*dyn_user*"]
set bnchans {#aite}
bind join - * ban:bnick
bind nick - * ban:bnick
proc ban:bnick {nick uhost hand chan {nn ""}} {
if {[lsearch -exact $bnchans $chan] == -1} {return 0}
global badnicks
set bbanmask "*!*@[lindex [split $uhost @] 1]"
if {$nn == ""} { set nn $nick }
if {![isbotnick $nick]} {
foreach badnick $badnicks {
if {[string match -nocase $badnick $nn]} {
putserv "MODE $chan +b $bbanmask"
putserv "KICK $chan $nick :Please Identify, before you enter this channel, and or make sure you auto-ident when you disconnect This ban will expire in 15 Minutes ."
break
}
}
}
} |
I get an error, is there something I did wrong?
| Code: | | [08:12] Tcl error [ban:bnick]: can't read "bnchans": no such variable |
|
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Sun Apr 02, 2006 12:02 pm Post subject: |
|
|
| Sir_Fz wrote: | | you would want to make the channels lower-case since [lsearch] is case-sensitive. |
I'd recommned using the same capitalition as the bot knows them (like shown in .status).
| DJmart wrote: | I get an error, is there something I did wrong?
| Code: | | [08:12] Tcl error [ban:bnick]: can't read "bnchans": no such variable |
|
Read this again:
| Sir_Fz wrote: | | bnchans should be globalized inside the proc |
that means you either add it to the global line or add :: behind the $ for each call to that var within a proc. _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
|