TCLDROP
Would you like to react to this message? Create an account in a few clicks or log in to continue.
TCLDROP

Eggdrop And TCL Help, Support And Chat
 
HomeHome  PublicationsPublications  FAQFAQ  SearchSearch  MemberlistMemberlist  Latest imagesLatest images  UsergroupsUsergroups  RegisterRegister  Log in  CalendarCalendar  WebsiteWebsite  ChatRoomChatRoom  

 

 ClearBans

Go down 
AuthorMessage
ComputerTech
Owner
Owner
ComputerTech


Posts : 99
Points : 268
Reputation : 0
Join date : 2020-04-30

ClearBans  Empty
PostSubject: ClearBans    ClearBans  Empty21/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."
      }
  }
}
Back to top Go down
http://www.computer-tech1.webnode.co.uk
 
ClearBans
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
TCLDROP :: Other :: Code-
Jump to: