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}`); + } } } }