From 53e838e6df6a9081cb04538d045b881d70735621 Mon Sep 17 00:00:00 2001 From: Milkshake Date: Wed, 27 Nov 2024 05:57:38 -0500 Subject: [PATCH] Reaction autoremove: Add logging (#245) --- .env-example | 1 + Events/ReactionEvent.cs | 2 ++ config.json | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/.env-example b/.env-example index ec20db94..c6691cee 100644 --- a/.env-example +++ b/.env-example @@ -4,5 +4,6 @@ CLIPTOK_ANTIPHISHING_ENDPOINT=useyourimagination CLOUDFLARED_TOKEN=ignoreifnotrelevant USERNAME_CHECK_ENDPOINT=https://api.example.com/username CLIPTALK_WEBHOOK=https://discord.com +REACTION_LOG_WEBHOOK=https://discord.com UPTIME_KUMA_PUSH_URL= TS_AUTHKEY=tskey-auth-asdfg-asdfghj \ No newline at end of file diff --git a/Events/ReactionEvent.cs b/Events/ReactionEvent.cs index 49c16b62..76895106 100644 --- a/Events/ReactionEvent.cs +++ b/Events/ReactionEvent.cs @@ -24,6 +24,8 @@ public static async Task OnReaction(DiscordClient _, MessageReactionAddedEventAr unban_msg_rx.IsMatch(targetMessage.Content)) { await targetMessage.DeleteReactionAsync(e.Emoji, e.User); + var emoji = e.Emoji.Id != 0 ? $"[{e.Emoji.Name}](<{e.Emoji.Url}>)" : e.Emoji.ToString(); + await LogChannelHelper.LogMessageAsync("reactions", $"{cfgjson.Emoji.Deleted} Removed reaction {emoji} from [this message]({e.Message.JumpLink}) by {e.User.Mention}"); return; } diff --git a/config.json b/config.json index 6e07ab7d..2f9f1206 100644 --- a/config.json +++ b/config.json @@ -287,6 +287,10 @@ }, "nicknames": { "channelId": 1280688061528674314 + }, + "reactions": { + "webhookEnvVar": "REACTION_LOG_WEBHOOK", + "channelId": 1311084236702482542 } }, "botOwners": [