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