From 48a04dbcbd905848c234381e9327cdd05115058a Mon Sep 17 00:00:00 2001 From: Teh PeGaSuS Date: Fri, 6 Mar 2026 09:32:13 +0100 Subject: [PATCH] Organize things better and fix a typo --- Chanban/cmgmt.tcl | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Chanban/cmgmt.tcl b/Chanban/cmgmt.tcl index 4ab9154..9211151 100644 --- a/Chanban/cmgmt.tcl +++ b/Chanban/cmgmt.tcl @@ -93,13 +93,6 @@ namespace eval cmgmt { bind msg * delop ::cmgmt::delop_msg bind msg * ops ::cmgmt::chanops_msg - # ---------- - # Auto add bans - # ---------- - # Add bans - bind mode * "*+b*" ::cmgmt::abans - bind mode * "*-b*" ::cmgmt::rbans - # Channel flag to auto add bans to the bot ban list setudef flag addBans @@ -126,6 +119,7 @@ namespace eval cmgmt { return } } + ::msgcat::mclocale $::cmgmt::locale ::msgcat::mcload [file join $cmgmt::lang_dir] @@ -626,8 +620,13 @@ namespace eval cmgmt { return 0 } + if {![validchan $chan]} { + putserv "PRIVMSG $nick :[::msgcat::mc bot.not.onchan $chan]" + return 0 + } + if {![matchattr $hand o|o $chan]} { - putserv "NOTICE $nick :[::msgcat::mc error.no.access $nick]" + putserv "PRIVMSG $nick :[::msgcat::mc error.no.access $nick]" return 0 } @@ -1233,6 +1232,13 @@ namespace eval cmgmt { } # ---------- DON'T TOUCH UNLESS YOU KNOW WHAT YOU'RE DOING ---------- # + # ---------- + # Auto add bans binds + # ---------- + # Add bans + bind mode * "*+b*" ::cmgmt::abans + bind mode * "*-b*" ::cmgmt::rbans + # ---------- # Auto add bans # ---------- @@ -1274,6 +1280,7 @@ namespace eval cmgmt { } # We also need to deal with the addition of extbans, since we don't deal with them internally + # but we need to add them as sticky to our database to prevent the bot from removing them if {[matchstr "~*" $target] && ![isban $target $chan]} { newchanban $chan $target $nick EXTBAN 0 sticky return 0 @@ -1302,6 +1309,8 @@ namespace eval cmgmt { # Lets check for existing extbans and add them to our ban list # and make them sticky so the bot doesn't remove them + # The removal will be mirrored (if the bot is online) as soon as + # a chanop removes the extban in the channel bind cron * "*/5 * * * *" ::cmgmt::addextbans proc addextbans {minute hour day month weekday} { # putlog "Adding existing extbans to banlist"