| View previous topic :: View next topic |
| Author |
Message |
gasak Halfop
Joined: 09 Aug 2010 Posts: 45
|
Posted: Mon May 21, 2012 12:38 am Post subject: [SOLVED] badword TCL |
|
|
I got this badword TCL somewhere else, and it suits to my need:
| Code: | set bwRun 1
set bwArray() ""
set bwNumber 0
set bwFilename "filename.txt"
set bwChan "#chan"
# SURVEYpub proc
bind pubm - * bwSurveypub
proc bwSurveypub {nick uhost hand channel args} {
global bwChan bwArray bwNumber bwRun passLogo
set channel [string tolower $channel]
if { $bwChan != $channel } {
return 0
}
if { ([isop $nick $bwChan])||([matchattr $nick o|o $bwChan])||([isvoice $nick $bwChan]) } {
return 0
}
set args [join $args]
set args [string tolower $args]
for {set i 0} {$i < $bwNumber} {incr i} {
if { $bwArray($i) != "" } {
set badw [join $bwArray($i)]
set dummy ""
if { [regsub -all "$badw" $args "" dummy] } {
putserv "MODE $channel +b $uhost"
putserv "KICK $bwChan $nick :Badword detected from '$badw' get out!"
}
}
}
return 0
} |
The problem i got here is that it just working only in one channel. I try to put several channel like
| Code: | | set bwChan "#chan1 #chan2" |
But its only recognize the first channel which is #chan1
What i need is it should work on every channel that i put on set bwChan and also will work in all channel when i leave the set bwChan to """"
Please help me on this thing. Thank you very much. _________________ Learning Knows No Boundaries!!
Last edited by gasak on Mon May 21, 2012 10:04 am; edited 1 time in total |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon May 21, 2012 7:26 am Post subject: |
|
|
There are at least two ways to make this work. First method would be to replace:
| Code: |
if { $bwChan != $channel } {
return 0
}
|
with:
| Code: |
if {[lsearch -nocase $bwChan $channel] == -1} {
return 0
}
|
Con: You would have to edit the tcl file every time you wish to add/remove a channel from the list.
The second method involves the removal of the same line like mentioned above and replacing it with:
| Code: |
if {![channel get $channel badword]} {
return 0
}
|
and replacing:
with:
| Code: |
setudef flag badword
|
Then, to enable/disable it on a channel it's a simple command on DCC chat or telnet with the bot: .chanset #channel +/-badword
if you decide to stick with the first method and want this work on all channels when the bwChan is set to "" then replace we change that line with:
| Code: |
if {[llength $bwChan]} {
if {![channel get $channel badword]} {
return 0
}
}
|
As for the second case, you just need to .chanset * +/-badword _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
|