From 54845033f1d4bf29aff6f8bd73b079c83c58c2e6 Mon Sep 17 00:00:00 2001 From: Harry Date: Fri, 20 Dec 2024 20:34:31 -0500 Subject: [PATCH] Update discord/events/MessageReactionRemove.ts Switched error messages to ephermal: true Signed-off-by: Harry --- discord/events/MessageReactionRemove.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/discord/events/MessageReactionRemove.ts b/discord/events/MessageReactionRemove.ts index 0323297..f16135c 100644 --- a/discord/events/MessageReactionRemove.ts +++ b/discord/events/MessageReactionRemove.ts @@ -28,11 +28,17 @@ export default class MessageReactionRemove extends DiscordEvent { // Attempt to unpin the message await reaction.message.unpin(); - const channel = reaction.message.channel; - await channel.send(`Unpinned message: ${reaction.message.id}`); + console.log(`Unpinned message: ${reaction.message.id}`); } catch (error) { - const channel = reaction.message.channel; - await channel.send(`Error unpinning message: ${error}`); + try { + const dmChannel = await user.createDM(); + await dmChannel.send({ + content: `There was an error unpinning the message: ${error.message}`, + ephemeral: true, + }); + } catch (dmError) { + console.error(`Failed to send ephemeral error message to ${user.tag}: ${dmError}`); + } } } }