##################################
### BanCount.tcl ###
### Version 1.1 ###
### By Wcc ###
### wcc@techmonkeys.org ###
### http://www.dawgtcl.com:81/ ###
### EFnet #|DAWG|Tcl ###
##################################
############################################################################
### Copyright 2000 - 2002 |DAWG| Scripting Group. All rights reserved. ###
############################################################################
#########################################################################
## This script adds the ".bans count [channel]" option, which returns ##
## the total number of global bans in the bot's banlist. If a channel ##
## is specified, the number of bans for that channel will be returned. ##
#########################################################################
##############
## COMMANDS ##
###############################################################################
## DCC ## .bans count [channel] ##
######### Returns the total number of global bans in the bot's banlist. If a ##
######### channel is specified, the number of bans for that channel will be ##
######### returned. ##
###############################################################################
##########################################################
## Just load the script, edit the settings, and rehash. ##
##########################################################
#####################################################
# Set the flag required to view the ban count here. #
#####################################################
set bancount_setting(flag) "+m"
###################################
# Enable use of bold in DCC chat? #
###################################
set bancount_setting(bold) 1
############################################
# Prefix "BANCOUNT:" in DCC chat messages? #
############################################
set bancount_setting(BANCOUNT:) 1
####################
# Code begins here #
####################
if {![string match 1.6.* $version]} { putlog "\002BANCOUNT:\002 \002WARNING:\002 This script is intended to run on eggdrop 1.6.x or later." }
if {[info tclversion] < 8.2} { putlog "\002BANCOUNT:\002 \002WARNING:\002 This script is intended to run on Tcl Version 8.2 or later." }
bind filt $bancount_setting(flag) ".bans count*" bancount_return
proc bancount_return {idx text} {
set text [split $text]
if {[set chan [join [lrange $text 2 2]]] == ""} {
set bans [llength [banlist]]
putdcc $idx "[bancount_dopre]There [expr {($bans != 1)?"are":"is"}] currently $bans ban[expr {($bans != 1)?"s":""}] in the global ban list."
return
}
if {![validchan $chan]} { putdcc $idx "[bancount_dopre]$chan is not a valid channel." ; return }
set bans [llength [banlist $chan]]
putdcc $idx "[bancount_dopre]There [expr {($bans != 1)?"are":"is"}] currently $bans ban[expr {($bans != 1)?"s":""}] in the ban list for [join $chan]."
}
proc bancount_dopre {} {
global bancount_setting
if {!$bancount_setting(BANCOUNT:)} { return "" }
if {!$bancount_setting(bold)} { return "BANCOUNT: " }
return "\002BANCOUNT:\002 "
}
putlog "\002BANCOUNT:\002 BanCount.tcl Version 1.1 by Wcc is loaded."