mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Fix race conditions and duplicate stars in starboard
This commit is contained in:
parent
1484f6b9a7
commit
e1e1854041
5 changed files with 63 additions and 9 deletions
|
@ -19,10 +19,22 @@ export class GuildStarboardReactions extends BaseGuildRepository {
|
|||
}
|
||||
|
||||
async createStarboardReaction(messageId: string, reactorId: string) {
|
||||
const existingReaction = await this.allStarboardReactions.findOne({
|
||||
where: {
|
||||
guild_id: this.guildId,
|
||||
message_id: messageId,
|
||||
reactor_id: reactorId,
|
||||
},
|
||||
});
|
||||
|
||||
if (existingReaction) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.allStarboardReactions.insert({
|
||||
guild_id: this.guildId,
|
||||
message_id: messageId,
|
||||
reactor_id: reactorId,
|
||||
guild_id: this.guildId,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue