diff --git a/config/audit_embed_template.json b/config/audit_embed_template.json new file mode 100644 index 0000000..6cee67d --- /dev/null +++ b/config/audit_embed_template.json @@ -0,0 +1,27 @@ +{ + "title_template": "### {icon} AUDIT #{id} — {ministry_upper}", + "lines_template": [ + "> 👤 **Auteur :** {actor_mention}", + "> 🧭 **Contexte :** {sphere}", + "> 🕒 **Date :** {time_tag}", + "", + "**⚡ Action :** {action}" + ], + "code_block_lang": "yaml", + "target_label": "Cible", + "footer_template": "Chaîne d'intégrité SHA-256 : {hash_short}…", + "ministries": { + "diamond": {"icon": "💎", "label": "Ministère du Diamant", "color": "#4EE2EC"}, + "emerald": {"icon": "💸", "label": "Ministère des Émeraudes", "color": "#17DD62"}, + "netherite": {"icon": "🗄️", "label": "Ministère de la Netherite", "color": "#4C484C"}, + "coal": {"icon": " ", "label": "Ministère du Charbon", "color": "#2B2B2B"}, + "iron": {"icon": "⚙️", "label": "Ministère du Fer", "color": "#D8D8D8"}, + "copper": {"icon": "🏗️", "label": "Ministère du Cuivre", "color": "#E77C56"}, + "lapis": {"icon": "🔬", "label": "Ministère du Lapis", "color": "#1E438C"}, + "redstone": {"icon": "🧲", "label": "Ministère de la Redstone", "color": "#FF0000"}, + "gold": {"icon": "🚋", "label": "Ministère de l'Or", "color": "#FCEE4B"}, + "quartz": {"icon": "⏱️", "label": "Ministère du Quartz", "color": "#EAE5DE"}, + "resin": {"icon": "📜", "label": "Ministère de la Résine", "color": "#FC7812"}, + "amethyst": {"icon": "🔮", "label": "Ministère de l'Améthyste", "color": "#9A5CC6"} + } +} diff --git a/core/audit_core.py b/core/audit_core.py index 0ab0594..049cd3b 100644 --- a/core/audit_core.py +++ b/core/audit_core.py @@ -39,8 +39,10 @@ def _notify_discord_socket(event_id: int): if not os.path.exists(AUDIT_SOCK): return try: - with socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) as s: - s.sendto(str(event_id).encode("utf-8"), AUDIT_SOCK) + with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s: + s.settimeout(1.0) + s.connect(AUDIT_SOCK) + s.sendall(f"{event_id}\n".encode("utf-8")) except Exception: pass