ComputerTech Owner
Posts : 99 Points : 268 Reputation : 0 Join date : 2020-04-30
| Subject: ClearBans 21/5/2020, 22:14 | |
| This is a great script that will clear all channel bans (not internal bot bans) cheers to cesar - Code:
-
set clearbans(max) 6
bind pub -|- !clearbans clear:bans
proc clear:bans {nick uhost hand chan text} { global clearbans set chan [string tolower $chan] if {![botisop $chan]} return set clearbans($chan) {} bind raw - 367 cb:bind:raw bind raw - 368 cb:bind:raw putserv "MODE $chan b" }
proc cb:bind:raw {from key text} { global clearbans switch -- $key { 367 { lassign [split $text] bot chan mask set chan [string tolower $chan] if {![info exists clearbans($chan)]} return if {[lsearch $clearbans($chan) $mask] > -1} return lappend clearbans($chan) $mask } 368 { lassign [split $text] bot chan set chan [string tolower $chan] if {![info exists clearbans($chan)]} return unbind raw - 367 cb:bind:raw unbind raw - 368 cb:bind:raw set len [llength $clearbans($chan)] set total 0 if {$len > 0} { while {$len > 0} { if {$len > $clearbans(max)} { set mode [string repeat "b" $clearbans(max)] set masks [join [lrange $clearbans($chan) 0 [expr {$clearbans(max) - 1}]]] set clearbans($chan) [lrange $clearbans($chan) $clearbans(max) end] incr len -$clearbans(max) incr total $clearbans(max) } else { set mode [string repeat "b" $len] set masks [join $clearbans($chan)] incr total $len set len 0 } puthelp "MODE $chan -$mode $masks" } } else { puthelp "PRIVMSG $chan :Bans list is empty." } puthelp "PRIVMSG $chan :Removed $total bans and list is now empty." } } } | |
|