From 2fa7be4b91e090e8d30a7e88793ce3042f2ea060 Mon Sep 17 00:00:00 2001 From: Teh PeGaSuS Date: Tue, 3 Mar 2026 19:25:57 +0100 Subject: [PATCH] Add error message on the three supported languages Ff the script fails to load due to the lack of `msgcat`, warn in the same language as the one set on $::cmgmt::locale --- Chanban/cmgmt.tcl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Chanban/cmgmt.tcl b/Chanban/cmgmt.tcl index be938ea..bc4f4dc 100644 --- a/Chanban/cmgmt.tcl +++ b/Chanban/cmgmt.tcl @@ -8,7 +8,7 @@ namespace eval cmgmt { # Configuration # ---------- # Language to be use on this script - # Available languages: en (English) + # Available languages: en (English), it (Italian), pt (Portuguese European) variable locale "en" # Directory where the language files are located @@ -23,7 +23,7 @@ namespace eval cmgmt { # Command to upload the file # The ban list file is piped into the command via stdin (with `cat $filename |`) # so your command must read from stdin - variable upCommand "curl -s -F file=@- https://x0.at/" + variable upCommand "curl -s -F file=@- https://hotpaste.0bin.xyz/" # Set the banmask type to use in banning the user # Available types are: @@ -101,8 +101,18 @@ namespace eval cmgmt { # If you touch the code below and then complain the script "suddenly stopped working" I'll touch you at night. # ---------- if { [catch { package require msgcat }] } { - putloglev o * "\[Channel Management\] This script needs msgcat package to work. The script cannot be loaded." - return + if {$cmgmt::locale eq "en"} { + putloglev o * "\[Channel Management\] This script needs msgcat package to work. The script cannot be loaded." + return + } + if {$::cmgmt::locale eq "it"} { + putloglev o * "\[Channel Management\] Questo script richiede il pacchetto msgcat per funzionare. Lo script non può essere caricato." + return + } + if {$::cmgmt::locale eq "pt"} { + putloglev o * "\[Channel Management\] Este script necessita do pacote msgcat para funcionar. O script não pode ser carregado." + return + } } ::msgcat::mclocale $::cmgmt::locale ::msgcat::mcload [file join $cmgmt::lang_dir]