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.

Lines Flood first time set muteban second time full ban

Help for those learning Tcl or writing their own scripts.
Post Reply
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Lines Flood first time set muteban second time full ban

Post by simo »

greetz im using this code and it works as intended it sets a temporare muteban after 3 lines in 4 seconds are posted in channel and unsets it after few seconds but we noticed some are in channel to keep flooding so setting another temporare muteban is useless we wanted to set a full ban the second time it happens and unset the counter

heres what we work with:

Code: Select all

# lines flood
set textftrigger 3:4

bind ctcp - "ACTION" actionf
proc actionf {n u h d k t} {
  if {[isbotnick $d]} {  return 0  }
  textf $n $u $h $d $t
}


bind pubm - * textf
proc textf {nick uhost hand chan text} {
 if {[matchattr [nick2hand $nick] fmo|fmo $chan] || [isvoice $nick $chan]} { return } 
 global textftrigger textf
 if {[string match -nocase #help $chan]} { return 0 }
 if {![info exists textf([set f [string tolower $uhost:$chan]])]} {
  set textf($f) 0
 }
 utimer [lindex [split $textftrigger :] 1] [list incr textf($f) -1]
 if {[incr textf($f)] >= [lindex [split $textftrigger :] 0]} {
  if {[isvoice $nick $chan]} {  pushmode2  $chan -v  $nick }
  pushmode $chan +b m:*!*@[lindex [split $uhost @] 1]
  putserv "notice $nick :[colors] you have been temporary muted due to mass text lines....... slow down [end]"
  after [expr {30*1000*1}] [list pushmode2 $chan -b m:*!*@[lindex [split $uhost @] 1]]
 }
}

 
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

The idea is to set a ban the second time it's triggered let's say within 2 minutes without having the timer removing it again
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i guess it needs some sort of counter based on channel:nick:host
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

for example:
if the first time its triggered it sets a muteban and unsets it after like 30 secs
09:06:19 (Hitoshi) : ilpwinwgzr omplezjwnd
09:06:20 (Hitoshi) : sqlbmhpief rsbyhvvopn
09:06:20 (Hitoshi) : ulnoexbkwy zlqktpxexd
09:06:21 @Falcon Sets Mode on #TestChan to: +b m:*!*@All4Masti-ac4.9jb.714.980.IP

09:06:51 @Falcon Sets Mode on #TestChan to: -b m:*!*@All4Masti-ac4.9jb.714.980.IP

and when it triggers a second time from same $chan:$host:$nick within lets say 2 minutes then set a full ban without removing it
09:07:25 (Hitoshi) : ftpdvzjtrd tkbnsclrdl
09:07:26 (Hitoshi) : jqdmelwvvb tffnnzkcvp
09:07:26 (Hitoshi) : jwbeufyoad gwisxzdymv
09:07:26 (Hitoshi) : wgrhxrjgso gqwmsyrtjs
09:07:26 @Falcon Sets Mode on #TestChan to: +b *!*@All4Masti-ac4.9jb.714.980.IP
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Since you are working with scripts, you may be able to do that.

Here is an example (not tested), try to understand it.

Code: Select all

# lines flood
set textftrigger 3:4
set warned {}

bind ctcp - "ACTION" actionf
proc actionf {n u h d k t} {
	if {[isbotnick $d]} {  return 0  }
	textf $n $u $h $d $t
}


bind pubm - * textf
proc textf {nick uhost hand chan text} {
	global textftrigger textf warned
	if {[matchattr [nick2hand $nick] fmo|fmo $chan] || [isvoice $nick $chan]} { return }
	if {[string match -nocase #help $chan]} { return 0 }
	if {![info exists textf([set f [string tolower $uhost:$chan]])]} {
		set textf($f) 0
	}
	set umask "${chan}.${uhost}.${nick}"
	utimer [lindex [split $textftrigger :] 1] [list incr textf($f) -1]
	if {[incr textf($f)] >= [lindex [split $textftrigger :] 0]} {
		if {[isvoice $nick $chan]} {  pushmode2  $chan -v  $nick }
		if {[lsearch $warned $umask]>-1} {
			pushmode $chan +b *!*@[lindex [split $uhost @] 1]
			putkick $chan $nick "Sorry but repeating flood"
			set warned [lreplace $warned [lsearch $warned $umask] [lsearch $warned $umask]]
		} else {
			lappend warned $umask
			pushmode $chan +b m:*!*@[lindex [split $uhost @] 1]
			putserv "notice $nick :[colors] you have been temporary muted due to mass text lines....... slow down [end]"
			after [expr {30*1000*1}] [list pushmode2 $chan -b m:*!*@[lindex [split $uhost @] 1]]
		}
	}
}
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

thanks CrazyCat for the reply ive tried your suggested code it seems to work as expected so far, .... i will test it some more thanks so far CrazyCat
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Post by Arnold_X-P »

CrazyCat wrote:Since you are working with scripts, you may be able to do that.

Here is an example (not tested), try to understand it.

Code: Select all

# lines flood
set textftrigger 3:4
  set repeatwarnmsg1 "stop please"
  set repeatwarnmsg2 "Final warning.."
set warned {}

bind ctcp - "ACTION" actionf
proc actionf {n u h d k t} {
	if {[isbotnick $d]} {  return 0  }
	textf $n $u $h $d $t
}


bind pubm - * textf
proc textf {nick uhost hand chan text} {
	global textftrigger textf warned
	if {[matchattr [nick2hand $nick] fmo|fmo $chan] || [isvoice $nick $chan]} { return }
	if {[string match -nocase #help $chan]} { return 0 }
	if {![info exists textf([set f [string tolower $uhost:$chan]])]} {
		set textf($f) 0
	}
	set umask "${chan}.${uhost}.${nick}"
	utimer [lindex [split $textftrigger :] 1] [list incr textf($f) -1]
	if {[incr textf($f)] >= [lindex [split $textftrigger :] 0]} {
		if {[isvoice $nick $chan]} {  pushmode2  $chan -v  $nick }
		if {[lsearch $warned $umask]>-1} {
			pushmode $chan +b *!*@[lindex [split $uhost @] 1]
			putkick $chan $nick "Sorry but repeating flood"
			set warned [lreplace $warned [lsearch $warned $umask] [lsearch $warned $umask]]
		} else {
			lappend warned $umask
			pushmode $chan +b m:*!*@[lindex [split $uhost @] 1]
			putserv "notice $nick :[colors] you have been temporary muted due to mass text lines....... slow down [end]"
			after [expr {30*1000*1}] [list pushmode2 $chan -b m:*!*@[lindex [split $uhost @] 1]]
		}
	}
}
it can be added that it launches two warning phrases and the third definitive ban???
set repeatwarnmsg1 "stop please"
set repeatwarnmsg2 "Final warning.."
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

You can try the following code (untested):

Code: Select all

# lines flood
set textftrigger 3:4
set repeatwarnmsg {"stop please" "Final warning.."}
set warned {}

bind ctcp - "ACTION" actionf
proc actionf {n u h d k t} {
	if {[isbotnick $d]} {  return 0  }
	textf $n $u $h $d $t
}


bind pubm - * textf
proc textf {nick uhost hand chan text} {
	global textftrigger textf warned
	if {[matchattr [nick2hand $nick] fmo|fmo $chan] || [isvoice $nick $chan]} { return }
	if {[string match -nocase #help $chan]} { return 0 }
	if {![info exists textf([set f [string tolower $uhost:$chan]])]} {
		set textf($f) 0
	}
	set umask "${chan}.${uhost}.${nick}"
	utimer [lindex [split $textftrigger :] 1] [list incr textf($f) -1]
	if {[incr textf($f)] >= [lindex [split $textftrigger :] 0]} {
		if {[isvoice $nick $chan]} {  pushmode2  $chan -v  $nick }
		if {[lsearch $warned $umask]>-1 && [info exists ::cpt($umask)] && $::cpt($umask)>=[llength $::repeatwarnmsg]} {
			pushmode $chan +b *!*@[lindex [split $uhost @] 1]
			putkick $chan $nick "Sorry but repeating flood"
			set warned [lreplace $warned [lsearch $warned $umask] [lsearch $warned $umask]]
			unset ::cpt($umask)
		} else {
			if {[lsearch $warned $umask]==-1} { lappend warned $umask }
			incr ::cpt($umask) 1
			pushmode $chan +b m:*!*@[lindex [split $uhost @] 1]
			putserv "notice $nick :[colors] [lindex $::repeatwarnmsg $::cpt($umask)] [end]"
			after [expr {30*1000*1}] [list pushmode2 $chan -b m:*!*@[lindex [split $uhost @] 1]]
		}
	}
}
If you want to allow more warnings, just add messages in repeatwarnmsg, the user will be ban when all the messages are sent
Post Reply