Skip to content

Commit fcb394b

Browse files
author
0xMett
committed
feat(strings): add Italian strings for ban notifications and welcome delay commands
Add ban_notification() formatter, update BAN_USAGE for @handle and welcome reply, add SETWELCOMEDELAY/GETWELCOMEDELAY strings.
1 parent a7bae01 commit fcb394b

1 file changed

Lines changed: 48 additions & 8 deletions

File tree

src/python_italy_bot/strings.py

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
)
2222

2323
VERIFY_READ_RULES_CONTENT = (
24-
"Ecco il regolamento. Leggilo e invia il comando segreto che troverai:\n\n"
25-
"{content}"
24+
"Ecco il regolamento. Leggilo e invia il comando segreto che troverai:\n\n{content}"
2625
)
2726

2827
VERIFY_SEND_SECRET = "Invia il comando segreto per completare la verifica."
@@ -36,15 +35,14 @@
3635
"Se hai appena completato la verifica, potrebbe essere già stata applicata."
3736
)
3837

39-
VERIFY_SUCCESS = (
40-
"Verifica completata. Accesso concesso alla comunità Python Italia."
41-
)
38+
VERIFY_SUCCESS = "Verifica completata. Accesso concesso alla comunità Python Italia."
4239

4340
VERIFY_UNKNOWN_COMMAND = (
4441
"Comando non riconosciuto. Leggi il regolamento "
4542
"e invia il comando segreto che troverai."
4643
)
4744

45+
4846
def get_default_welcome_template(bot_username: str) -> str:
4947
"""Return the default welcome message template with Matrix/Python flair."""
5048
return (
@@ -67,7 +65,11 @@ def get_default_welcome_template(bot_username: str) -> str:
6765
GROUP_REGISTERED = "Gruppo registrato. Chat ID: {chat_id}"
6866

6967
# Ban
70-
BAN_USAGE = "Uso: /ban user_id [motivo], o rispondi al messaggio con /ban [motivo]."
68+
BAN_USAGE = (
69+
"Uso: /ban user_id|@username [motivo], "
70+
"o rispondi a un messaggio (anche di benvenuto) con /ban [motivo]."
71+
)
72+
7173

7274
def ban_success(success_count: int, fail_count: int, reason: str | None) -> str:
7375
"""Format ban success message."""
@@ -77,19 +79,43 @@ def ban_success(success_count: int, fail_count: int, reason: str | None) -> str:
7779
msg += f"\nMotivo: {reason or 'Nessuno'}"
7880
return msg
7981

82+
83+
def ban_notification(
84+
chat_title: str,
85+
banned_name: str,
86+
banned_id: int,
87+
admin_name: str,
88+
admin_id: int,
89+
success_count: int,
90+
reason: str | None,
91+
) -> str:
92+
"""Format ban notification message for admins."""
93+
text = f"<b>{chat_title}:</b>\n"
94+
text += f'Utente bannato: <a href="tg://user?id={banned_id}">{banned_name}</a> ({banned_id})\n'
95+
text += (
96+
f'Bannato da: <a href="tg://user?id={admin_id}">{admin_name}</a> ({admin_id})\n'
97+
)
98+
text += f"Gruppi: {success_count}\n"
99+
text += f"Motivo: {reason or 'Nessuno'}"
100+
return text
101+
102+
80103
# Unban
81104
UNBAN_USAGE = "Uso: /unban user_id, o rispondi al messaggio con /unban"
82105

106+
83107
def unban_success(success_count: int, fail_count: int) -> str:
84108
"""Format unban success message."""
85109
msg = f"Utente sbannato globalmente da {success_count} gruppi."
86110
if fail_count > 0:
87111
msg += f" ({fail_count} falliti)"
88112
return msg
89113

114+
90115
# Mute
91116
MUTE_USAGE = "Uso: /mute @username [minuti] [motivo], o rispondi al messaggio"
92117

118+
93119
def mute_success(duration: int | None, reason: str | None) -> str:
94120
"""Format mute success message."""
95121
msg = "Utente mutato"
@@ -99,6 +125,7 @@ def mute_success(duration: int | None, reason: str | None) -> str:
99125
msg += f". Motivo: {reason}"
100126
return msg
101127

128+
102129
MUTE_FAILED = "Impossibile mutare l'utente."
103130

104131
# Unmute
@@ -131,6 +158,19 @@ def mute_success(duration: int | None, reason: str | None) -> str:
131158
GETWELCOME_CUSTOM = "Messaggio di benvenuto attuale:\n\n{message}"
132159
GETWELCOME_DEFAULT = "Nessun messaggio personalizzato. Default:\n\n{message}"
133160

161+
# Welcome delay
162+
SETWELCOMEDELAY_USAGE = "Uso: /setwelcomedelay <minuti> (0 per disattivare)"
163+
SETWELCOMEDELAY_SUCCESS = (
164+
"Ritardo cancellazione messaggio di benvenuto impostato a {minutes} minuti."
165+
)
166+
SETWELCOMEDELAY_DISABLED = (
167+
"Cancellazione automatica del messaggio di benvenuto disattivata."
168+
)
169+
GETWELCOMEDELAY_RESPONSE = (
170+
"Ritardo cancellazione messaggio di benvenuto: {minutes} minuti."
171+
)
172+
GETWELCOMEDELAY_DEFAULT = "Nessun ritardo configurato. Default: 5 minuti."
173+
134174

135175
# =============================================================================
136176
# ID COMMAND
@@ -146,13 +186,13 @@ def mute_success(duration: int | None, reason: str | None) -> str:
146186
ANNOUNCE_OWNER_ONLY = "Solo il proprietario del bot può usare questo comando."
147187
ANNOUNCE_NO_OWNER_CONFIGURED = "BOT_OWNER_ID non configurato."
148188
ANNOUNCE_USAGE = (
149-
"Uso: /announce <messaggio>\n\n"
150-
"Supporta HTML e bottoni: [Testo](buttonurl://url)"
189+
"Uso: /announce <messaggio>\n\nSupporta HTML e bottoni: [Testo](buttonurl://url)"
151190
)
152191
ANNOUNCE_EMPTY_MESSAGE = "Il messaggio non può essere vuoto."
153192
ANNOUNCE_NO_GROUPS = "Nessun gruppo registrato."
154193
ANNOUNCE_SENDING = "Invio annuncio a {count} gruppi..."
155194

195+
156196
def announce_result(success: int, failed: int) -> str:
157197
"""Format announcement result message."""
158198
return f"Annuncio inviato: {success} ok, {failed} falliti."

0 commit comments

Comments
 (0)