| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat May 30, 2015 7:20 pm Post subject: bad channel with wildcard |
|
|
hi folks,
i was wondering why this bad chan tcl doesnt work properly all i changed is the channel kicker cause i wanted it to work on all channels bot is sitting
| Code: | bind join - * bad:whois
bind raw - 319 bad:chan:chk
# Set your Bad channel kicker's CHANNELS here (Type in lower case)
set bchan_chans "*"
# Set your Bad channel kicker's KICK MSG here
set bchan_kmsg "You are on a bad channel"
######### Stop editing here, unless u know how to #####
set badchanwrds {
"*incest*"
"*sex*"
"*gay*"
}
proc bad:whois {n h c a} {
global join_ctr
if {[isbotnick $n]} {return 0}
set c [string tolower $c]
if {[matchattr $h f]} {return 0}
putserv "WHOIS $n"
if {![info exists join_ctr($c)]} {set join_ctr($c) 0}
incr join_ctr($c) 1
if {$join_ctr($c) >= "5"} {
set join_ctr($c) 1
if {[catch {unbind join - * bad:whois}]} {}
utimer 2 whois:reset
}
}
proc whois:reset {} {
bind join - * bad:whois
}
set colore {([\002\017\026\037]|[\003]{1}[0-9]{0,2}[\,]{0,1}[0-9]{0,2})}
proc bad:chan:chk {from mask args} {
global badchanwrds colore
set args [split $args]
set nick [lindex $args 1]
set listchans [lrange $args 2 end]
regexp -- {^:?(.*)$} [join $listchans] -> text
set text [split $text]
regsub -all $colore $text {} text
foreach txt $text {
foreach bw $::badchanwrds {
if {[string match -nocase "$bw" "$txt"]} {
badchan:kick $nick $bw
break
}
}
}
}
proc badchan:kick {nick bchan} {
global bchan_chans bchan_bantime bchan_kmsg
foreach chan $bchan_chans {
if {[onchan $nick $chan]} {
if {([isop $nick $chan]) || (![botisop $chan])} {return 0}
set bmask [getchanhost $nick $chan] ; set bmask [lindex [split $bmask @] 1]
putquick "MODE $chan +b *!*@$bmask" -next
putquick "KICK $chan $nick : $bchan_kmsg ($bchan)" -next
return 0
}
return 0
}
}
foreach c $bchan_chans {
set join_ctr($c) 0
}
array set join_ctr {}
putlog "badchan.tcl Banned Channel Protection loaded."
|
|
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sat May 30, 2015 11:33 pm Post subject: |
|
|
You changed this line, correct?
| Code: |
set bchan_chans "*"
|
Instead of a list of chans, you changed it to that asterisk ?
At a fast glance (I have not tested it) try this:
comment out that line, then add a new line:
| Code: |
# set bchan_chans "*"
set bchan_chans [channels]
|
reference:
http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html
and find the
channels
command there and see the description.
I hope this helps. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun May 31, 2015 7:05 am Post subject: |
|
|
thanx for your reply willy i changed that and i also just tried your solution but it doesnt seem to help it whoises and does nothing else
and im not gettin any error neither |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun May 31, 2015 8:40 am Post subject: |
|
|
| also it would help if throtle could be integrated so bot wont be disconnected if mass bots join channel choking the bot |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sun May 31, 2015 10:05 am Post subject: |
|
|
| simo wrote: |
....and does nothing else
|
Find this:
| Code: |
foreach chan $bchan_chans {
if {[onchan $nick $chan]} {
if {([isop $nick $chan]) || (![botisop $chan])} {return 0}
set bmask [getchanhost $nick $chan] ; set bmask [lindex [split $bmask @] 1]
putquick "MODE $chan +b *!*@$bmask" -next
putquick "KICK $chan $nick : $bchan_kmsg ($bchan)" -next
return 0
}
return 0
}
|
Change to:
| Code: |
foreach chan $bchan_chans {
if {[onchan $nick $chan]} {
if {([isop $nick $chan]) || (![botisop $chan])} {return 0}
set bmask [getchanhost $nick $chan] ; set bmask [lindex [split $bmask @] 1]
putquick "MODE $chan +b *!*@$bmask" -next
putquick "KICK $chan $nick : $bchan_kmsg ($bchan)" -next
return 0
}
## return 0
}
|
| simo wrote: | | also it would help if throtle could be integrated so bot wont be disconnected if mass bots join channel choking the bot |
Sorry.
I don't care for this script.
When looking at someone else's code, it is always difficult enough.
This one though, just seems extra strange to me. Before I would do much more with it, I think I would just start over.
However, if you wish to continue with it, you can search this forum, for a couple of posts by the forum name of:
user
He posted a short throttle script, in a couple versions, some time ago. They are still here on the forum.
You can find them, examine them, and implement one of them if you wish. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun May 31, 2015 10:26 am Post subject: |
|
|
i did the sugestion you posted it still doesnt ban if bad chan is detected
would you recommend another tcl wich has the option of wildcard
like: ch*annel* |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sun May 31, 2015 10:38 am Post subject: |
|
|
| simo wrote: | i did the sugestion you posted it still doesnt ban if bad chan is detected
|
With a very brief test, for me it did do the ban.
| Quote: |
would you recommend another tcl wich has the option of wildcard
like: ch*annel* |
No, sorry. I have not looked closely.
I like, and use, All Protection. It can do this, but I don't recall if it can use wildcards. Obviously, I don't use that function.
It has a LOT of different protection functions.
If you want to check it out, the link to the author's download site/blog is in his post here:
http://forum.egghelp.org/viewtopic.php?p=101239#101239 _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun May 31, 2015 10:46 am Post subject: |
|
|
| hmm odd if you tested the same exact code and it did the ban could you post final code i might did some typo |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun May 31, 2015 11:52 am Post subject: |
|
|
For one thing, the author misuses the argument args.
Please try this proc instead of the current one... | Code: | proc bad:chan:chk {from mask arg} {
global badchanwrds colore
set arg [split $arg]
set nick [lindex $arg 1]
set listchans [lrange $arg 2 end]
regexp -- {^:?(.*)$} [join $listchans] -> text
set text [split $text]
regsub -all $colore $text {} text
foreach txt $text {
foreach bw $::badchanwrds {
if {[string match -nocase "$bw" "$txt"]} {
badchan:kick $nick $bw
break
}
}
}
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Thu Jun 04, 2015 1:15 pm Post subject: |
|
|
this is the idea in msl could some one translated it to tcl
it would be apreciated tnx in advance
| Code: | ON !*:JOIN:#: { IF ($nick(#,$me,@&~%)) { whois $nick } }
Raw 319:*: {
IF ($regex($3-,/ $+ $regsubex(sex|incest|[sf]uck|h[0o][0o]|anal|fag|[censored]|ass|pussy|twat|gay,//g,.*) $+ /i)) {
VAR %bchans = $regml(1)
VAR %t = $comchan($2,0)
WHILE (%t) {
var %chanz1 = $comchan($2,%t)
IF ($nick(%chanz1,$me,@&~%)) {
mode %chanz1 +b $address($2,4)
kick %chanz1 $2 your on a banned channel ( $+ $+($chr(35),*,%bchans,*) $+ ) leave it and rejoin.
}
DEC %t
}
}
} |
|
|
| Back to top |
|
 |
|