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.

Sticky

Old posts that have not been replied to for several years.
Locked
M
Mash
Voice
Posts: 24
Joined: Sat May 29, 2004 12:44 am

Sticky

Post by Mash »

I have this script here which sets sticky ban for 1 min, and creates a new ban if someone removes it before it expires
Is there some way this stickyban can be made in to normal ban, i mean to say, even if it creates ban , when some ops remove the ban from chan, bots should also remove the particular ban from its list.Would be a great if someone could help.
thanks in advance :o


Code: Select all

# Let's now begin setting up variables!

# You may use this variable to either Enable or Disable Control-Code Checking feature.
# If you set this to "1", the bot will count the maximum length of any control codes-
# phrased in the channel or to itself from a user.
# The control codes I meant are Bold, Underline, Color.
# Set this to "0" if you do not wish to use this feature.
set chktsu 1

# This variable is used to either Enable or Disable Character Length Checking feature.
# If you set this to "1", the bot will count the maximum length of any characters-
# phrased in the channel or to itself from a user.
# Set this to "0" if you do not wish to use this feature.
set chkltx 1

# This variable is used to determine MAXIMUM VALUES allowed for control codes.
# If you set "chktsu" to "1", the bot will count control codes. And if it found-
# that control codes phrased are more and/or same with "tsu_maxchar", then it will-
# trigger the ban and locking procedure.
set tsu_maxchar 100

# This variable is used to determine MAXIMUM VALUES allowed for any characters.
# If you set "chkltx" to "1", the bot will count any characters pasted. And if it-
# found that characters phrased are more and/or same with "ltx_maxchar", then it-
# will trigger the ban and locking procedure.
set ltx_maxchar 300

# Ah, you may want to exclude some hosts from being checked by the bot for-
# control codes and/or character length. Well, this is where you may set-
# them. Note that you can set this as many as you want. separated by lines.
# As an example below.
set tsu_hostallow {
  "@dal.net"
}

# You may put any kick messages below. As always you can put any kick-
# messages as many as you wish, separated by lines. The bot will use-
# one of these kick messages RANDOMLY. :)
# Note that this kick message variable used when the bot kick a user-
# triggered by "chktsu", exceeded control codes.
set tsu_kmsgs {
  "To many Control Codes!"
  "beh!"
}

# This one has same mechanism with above variable. But this variable-
# used when the bot kick a user triggered by "chkltx", exceeded-
# character length.
set ltx_kmsgs {
  "calm down, you can always separate your words into few lines!"
}

# Hey, we might not want kick an Operator in our own room, so this-
# is the variable where you might set it. Set this to "0" if you-
# do not wish the bot to kick/ban an Operator who had their control codes-
# exceeded, or character length exceeded. The bot will only 'insult' them.
set tsu_banop 0

# And this one is the 'insult' or some kind of warning message the bot will-
# say to an Operator that triggered kick/ban procedure caused by their-
# exceeded control codes. As usual you may want to put many 'insult' messages here.
# Just separate them by lines. The bot will pick one randomly.
set tsu_amsgs {
  "well, was it your finger so itchy or your CTRL button so sultry?"
}

# Same as above, but this message in this variable taken when an Operator-
# triggered kick/ban procedure caused by their exceeded characters.
set ltx_amsgs {
  "well, was it your finger so itchy or your keyboard keys so sultry?"
}

# This variable is used by the bot to determine how long it will ban the user-
# from a channel. The measurement time is in 'minute'.
# Note that this ban-time will only be used when control codes exceeds, regarding-
# that you've set "chktsu" to "1"
# Note that this variable is not used if you set "chktsu" to "0"
set tsu_bantime 1

# This variable is used by the bot to determine how long it will ignore the user.
# Like above, the measurement time is in 'minute'. But remember this is also used-
# ONLY when control codes exceeds, as above.
# Note that this variable is not used if you set "chktsu" to "0"
set tsu_ignoretime 1

# This variable is used by the bot to determine how long it will ban the user-
# from a channel. The measurement time is in 'minute'.
# Note that this ban-time will only be used when character length exceeds, regarding-
# that you've set "chkltx" to "1"
# Note that this variable is not used if you set "chkltx" to "0"
set ltx_bantime 1

# This variable is used by the bot to determine how long it will ignore the user.
# Like above, the measurement time is in 'minute'. But remember this is used-
# ONLY when character length exceeds, as above.
# Note that this variable is not used if you set "chkltx" to "0"
set ltx_ignoretime 1

# Here you can set either to Enable or Disable the locking feature regarding any floods-
# happened. Either it was an exceeded control codes or exceeded character length.
set tsu_lockchan 1

# Here you can set how long the bot will lock (+mc) (moderated and color lock), when-
# any of kick/ban/locking procedures triggered (includes both control code length and-
# character length). And the measurement time is in 'sec'.
# Note that this variable is ignored if you set "tsu_lockchan" to "0"
set tsu_locktime 40

# This is for your benefit hehe ;), you can either set your own LOGO here, your logo will appear-
# when the bot notice you, or when it makes msgs/notices/kicks or scripts loading. So keep smiling-
# and set this variable as you wish ;), you can either set this to "" to leave it blank.
set pltxlg "Ban :"

######### Please do not edit anything below unless you know what you are doing ;) #########

proc bottsutrig {nick uhost hand rest} {
	global botnick chktsu chkltx tsu_maxchar ltx_maxchar tsu_hostallow tsu_kmsgs tsu_amsgs ltx_kmsgs ltx_amsgs tsu_bantime tsu_ignoretime tsu_lockchan tsu_locktime ltx_bantime ltx_ignoretime pltxlg
	if {[isbotnick $nick] || [matchattr $hand o]} {return 0}
	foreach tallowhost [string tolower $tsu_hostallow] {
		if {[string match *$tallowhost* [string tolower $uhost]]} {return 0}
	}
 	if {[string match "#*" [lindex $rest 0]]} {
		set chan [lindex $rest 0] ; set tvictim $chan ; set rest [lrange $rest 1 end]
	} else {
		set chan "" ; set tvictim $botnick
	}
	if {$chktsu} {
		if {[string match *\002* $rest] || [string match ** $rest] || [string match * * $rest]} {
			set tlength [string length $rest] ; set bcode 0 ; set ucode 0 ; set kcode 0
			for {set i 0} {$i < $tlength} {incr i} {
				if {[string index $rest $i] == "\002"} {incr bcode}
				if {[string index $rest $i] == ""} {incr ucode}
				if {[string index $rest $i] == " "} {incr kcode}
			}
			if {$bcode >= $tsu_maxchar/3 || $ucode >= $tsu_maxchar/3 || $kcode >= $tsu_maxchar/3} {
				set banhost *!*@[lindex [split $uhost @] 1]
				set tsu_reason "$pltxlg \002Control Codes Exceed\002 (BC: \002$bcode\002 - UC: \002$ucode\002 - CC: \002$kcode\002) to \002$tvictim\002 from: \002$nick\002."
				set tsu_kmsg " 4$pltxlg \002$nick\002: (BC: \002$bcode\002 - UC: \002$ucode\002 - CC: \002$kcode\002): [lindex $tsu_kmsgs [rand [llength $tsu_kmsgs]]] "
				set tsu_amsg "$pltxlg $nick: (BC: \002$bcode\002 - UC: \002$ucode\002 - CC: \002$kcode\002): [lindex $tsu_amsgs [rand [llength $tsu_amsgs]]]"
				dotsuban $nick $uhost $banhost $chan $tsu_reason $tsu_kmsg $tsu_amsg $tsu_bantime $tsu_ignoretime
				putlog "$pltxlg \002Control Codes Exceed\002 (BC: \002$bcode\002 - UC: \002$ucode\002 - CC: \002$kcode\002) to \002$tvictim\002 from: \002$nick\002." ; return 0
			}
		}
	}
	if {$chkltx} {
		if {[string length $rest] >= $ltx_maxchar} {
			set banhost *!*@[lindex [split $uhost @] 1]
			set ltx_reason "$pltxlg \002Long Text\002 (\002[string length $rest]\002) to \002$tvictim\002 from: \002$nick\002."
			set ltx_kmsg " 4$pltxlg \002$nick\002: [lindex $ltx_kmsgs [rand [llength $ltx_kmsgs]]] "
			set ltx_amsg "$pltxlg $nick: (\002[string length $rest]\002): [lindex $ltx_amsgs [rand [llength $ltx_amsgs]]]"
			dotsuban $nick $uhost $banhost $chan $ltx_reason $ltx_kmsg $ltx_amsg $ltx_bantime $ltx_ignoretime
			putlog "$pltxlg \002Long Text\002 (\002[string length $rest]\002) to \002$tvictim\002 from: \002$nick\002." ; return 0
		}
	} ; return 0
}

proc dotsuban {nick uhost tbanhost tchan treason tkickmsg topmsg tbantime tignoretime} {
	global botnick tsu_banop tsu_lockchan tsu_locktime pltxlg
	if {$tchan != ""} {
		if {[botisop $tchan]} {
			if {[isop $nick $tchan]} {
				if {!$tsu_banop} {
					putquick "PRIVMSG $tchan :$topmsg" ; return 0
				}
			} ; newignore $tbanhost $botnick $treason $tignoretime
			putlog "$pltxlg Placing in Ignore on: \002$tbanhost\002 for \002$tignoretime\002 minute(s)."
			if {$tsu_lockchan} {
				putquick "MODE $tchan +MRc" -next ; if {$tsu_locktime <= 0} {set tsu_locktime 5}
				putlog "$pltxlg Activating Channel lock in channel: \002$tchan\002 for \002$tsu_locktime\002 sec(s)."
				utimer $tsu_locktime "utsulock $tchan"
			}
			newchanban $tchan $tbanhost $botnick $treason $tbantime
			set lmembers [chanlist $tchan]
			foreach tsumember $lmembers {
				set lselectedhost [getchanhost $tsumember $tchan]
				set tsubanhost *!*@[lindex [split $lselectedhost @] 1]
				if {$tbanhost == $tsubanhost} {
					if {[isop $tsumember $tchan]} {
						putquick "MODE $tchan -o+b $tsumember $tsumember!*@*"
					} ; putkick $tchan $tsumember $tkickmsg
				}
			}
		} else {
			newignore $tbanhost $botnick $treason $tignoretime
			putlog "$pltxlg Placing in Ignore on: \002$tbanhost\002 for \002$tignoretime\002 minute(s). Reason: $treason."
		}
	} else {
		newignore $tbanhost $botnick $treason $tignoretime
		putlog "$pltxlg Placing in Ignore on: \002$tbanhost\002 for \002$tignoretime\002 minute(s). Reason: $treason."
	} ; return 0
}  

proc chntsutrig {nick uhost hand chan rest} {
	global botnick ; append chars "$chan $rest" ; bottsutrig $nick $uhost $hand $chars
}

proc utsulock {tsu_chan} {
	global botnick pltxlg
	if {[validchan $tsu_chan]} {
		if {[botisop $tsu_chan]} {
			set tcurrmode [getchanmode $tsu_chan]
			if {[string match "*M*" $tcurrmode] || [string match "*R*" $tcurrmode] || [string match "*R*" $tcurrmode]} {
				putquick "MODE $tsu_chan -mMRc" ; putlog "$pltxlg Opening Channel lock on: \002$tsu_chan\002."
			}
		}
	} ; return 0
}

proc nottsutrig {from keyword arg} {
	global botnick
	set nick [lindex [split $from !] 0] ; set uhost [lindex [split $from !] 1]
	if {[string match "*.*" $from]} {return 0} ; set chan ""
	if {[string match "#*" [lindex $arg 0]]} {
		# if {[string match "*@*" [lindex $arg 0]]} {set chan [lindex [split [string tolower [lindex $arg 0]] @] 1]}
		set chan [lindex $arg 0] ; set rest [lrange $arg 1 end]
	} else {set rest $arg}
	if {$chan != ""} {
		append chars "$chan $rest"
	} else {
		set chars $rest
	} ; bottsutrig $nick $uhost $uhost $chars ; return 0
}
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

no, it doesn't create sticky bans

here's a code snippet which on channel unban should remove the corresponding bot ban (only if set by the script):

Code: Select all

bind mode - "% -b" unban
proc unban {n u h c m v} {
  foreach ban [banlist $c] {
    set mask [lindex $ban 0]; set creator [lindex $ban 5]
    if {[string equal -nocase $v $mask] && $creator == $::botnick} {
      killchanban $c $mask
    }
  }
}
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

There is a script called unbanparrot.tcl by egghead that removes internal bans when channel bans are removed you can find it here. Click Me
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
Locked