Skip to content

Commit

Permalink
⭐ Fixed starboard remove selfstar
Browse files Browse the repository at this point in the history
  • Loading branch information
wiki-Bird committed Jul 25, 2024
1 parent 0154428 commit db287b9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/events/messageReactionAdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,17 @@ const messageReactionAdd: Event<[MessageReaction | PartialMessageReaction, User
try {
const userUser = await client.users.fetch(user.id);
await userUser.send("You can't star your own message. Sorry :(");
await reaction.users.remove(user.id);

// Fetch the message to ensure we have the latest data
const fetchedMessage = await message.fetch();

// Remove only this user's reaction
try {
await fetchedMessage.reactions.cache.get(reaction.emoji.name!)?.users.remove(user.id);
}
catch {
console.log('nothing to remove?')
}
} catch (error) {
console.error(`Failed to send DM to user ${user.id}: ${error}`);
}
Expand Down

0 comments on commit db287b9

Please sign in to comment.