1
0
Fork 0

Update discord/events/MessageReactionAdd.ts

switched error messages to Ephemeral: true

Signed-off-by: Harry <harry@harryrosestudios.com>
master
Harry 2024-12-20 20:33:31 -05:00
parent e6dae3ae48
commit 65f4bd92dc
1 changed files with 10 additions and 4 deletions

View File

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