File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44and Python programming metaphors.
55"""
66
7+ import html
8+
79BOT_NAME = "Electus"
810
911# =============================================================================
@@ -90,13 +92,15 @@ def ban_notification(
9092 reason : str | None ,
9193) -> str :
9294 """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- )
95+ safe_chat_title = html .escape (chat_title , quote = True )
96+ safe_banned_name = html .escape (banned_name , quote = True )
97+ safe_admin_name = html .escape (admin_name , quote = True )
98+ safe_reason = html .escape (reason , quote = True ) if reason else "Nessuno"
99+ text = f"<b>{ safe_chat_title } :</b>\n "
100+ text += f'Utente bannato: <a href="tg://user?id={ banned_id } ">{ safe_banned_name } </a> ({ banned_id } )\n '
101+ text += f'Bannato da: <a href="tg://user?id={ admin_id } ">{ safe_admin_name } </a> ({ admin_id } )\n '
98102 text += f"Gruppi: { success_count } \n "
99- text += f"Motivo: { reason or 'Nessuno' } "
103+ text += f"Motivo: { safe_reason } "
100104 return text
101105
102106
You can’t perform that action at this time.
0 commit comments