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.

bad channel with wildcard

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
simo
Revered One
Posts: 1078
Joined: Sun Mar 22, 2015 2:41 pm

bad channel with wildcard

Post by simo »

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: Select all

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."
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

You changed this line, correct?

Code: Select all

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: Select all


# set bchan_chans "*" 

set bchan_chans [channels]

reference:
http://www.eggheads.org/support/egghtml ... mands.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 !
s
simo
Revered One
Posts: 1078
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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
s
simo
Revered One
Posts: 1078
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

also it would help if throtle could be integrated so bot wont be disconnected if mass bots join channel choking the bot
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

simo wrote: ....and does nothing else
Find this:

Code: Select all

 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: Select all

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 !
s
simo
Revered One
Posts: 1078
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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*
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

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.

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 !
s
simo
Revered One
Posts: 1078
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

hmm odd if you tested the same exact code and it did the ban could you post final code i might did some typo
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

For one thing, the author misuses the argument args.
Please try this proc instead of the current one...

Code: Select all

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
.
s
simo
Revered One
Posts: 1078
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

this is the idea in msl could some one translated it to tcl

it would be apreciated tnx in advance

Code: Select all

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
    }
  }
}
Post Reply