Update Chanban/chanban.tcl

Don't display extbans on the ban list since we shouldn't touch them.
If the ban list only has bans with the `EXTBAN` reason, the ban count will be 0
This commit is contained in:
Teh PeGaSuS
2026-03-01 22:29:59 +01:00
parent 15157bbeb0
commit b42c5166eb
+12 -5
View File
@@ -30,7 +30,7 @@ namespace eval cmgmt {
# so your command must read from stdin
variable upCommand "curl -s -F file=@- https://x0.at/"
# Set the banmask to use in banning the user
# Set the banmask type to use in banning the user
# Available types are:
# 0 *!user@host
# 1 *!*user@host
@@ -44,8 +44,9 @@ namespace eval cmgmt {
# 9 nick!*@*.host
variable banMask "2"
# Channel flag to auto add bans to the bot ban list
setudef flag addBans
# Mask type to use to track hostmasks that should not trigger auto adding bans
# Same type as banMask
variable noAddType "1"
# Nicks to ignore for auto adding bans
variable noAddNicks {
@@ -87,6 +88,9 @@ namespace eval cmgmt {
bind mode * "*+b*" ::cmgmt::abans
bind mode * "*-b*" ::cmgmt::rbans
# Channel flag to auto add bans to the bot ban list
setudef flag addBans
# ----------
# End of configuration
# ----------
@@ -96,14 +100,14 @@ namespace eval cmgmt {
#
# If you touch the code below and then complain the script "suddenly stopped working" I'll touch you at night.
# ----------
variable scriptName "Channel Management v1.0 \(01/03/2026-18:21\) by PeGaSuS"
variable scriptName "Channel Management v1.0 \(01/03/2026-22:21\) by PeGaSuS"
# ----------
# Auto add bans
# ----------
proc abans {nick uhost hand chan mode target} {
putlog "DEBUG autobans: nick=$nick chan=$chan mode=$mode target=$target"
set hostmask [maskhost ${nick}![getchanhost $nick $chan] 2]
set hostmask [maskhost ${nick}![getchanhost $nick $chan] $::cmgmt::noAddType]
set banReason "$::cmgmt::banReason \(auto-added\)"
if {![channel get $chan addBans]} {
@@ -149,6 +153,7 @@ namespace eval cmgmt {
# and make them sticky so the bot doesn't remove them
bind cron * "*/5 * * * *" ::cmgmt::addextbans
proc addextbans {minute hour day month weekday} {
putlog "Adding existing extbans to banlist"
foreach chan [channels] {
foreach cban [chanbans $chan] {
set mask [lindex [split $cban] 0]
@@ -302,6 +307,7 @@ namespace eval cmgmt {
}
set cbans [banlist $chan]
set cbans [lsearch -all -inline -not -index 1 $cbans "EXTBAN"]
if {$cbans eq ""} {
putserv "PRIVMSG $chan :ERROR! ${chan}'s ban list is empty."
return 0
@@ -611,6 +617,7 @@ namespace eval cmgmt {
}
set cbans [banlist $chan]
set cbans [lsearch -all -inline -not -index 1 $cbans "EXTBAN"]
if {$cbans eq ""} {
putserv "PRIVMSG $nick :ERROR! ${chan}'s ban list is empty."
return 0