3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-14 21:31:50 +00:00

starboard: prevent self-votes

This commit is contained in:
Dragory 2019-12-02 01:13:53 +02:00
parent 5ab6f59593
commit d403292ef6

View file

@ -183,6 +183,9 @@ export class StarboardPlugin extends ZeppelinPlugin<TConfigSchema> {
}
}
// No self-votes!
if (msg.author.id === userId) return;
const user = await this.resolveUser(userId);
if (user instanceof UnknownUser) return;
if (user.bot) return;
@ -212,7 +215,7 @@ export class StarboardPlugin extends ZeppelinPlugin<TConfigSchema> {
for (const starboard of applicableStarboards) {
// Save reaction into the database
await this.starboardReactions.createStarboardReaction(msg.id, userId).catch();
await this.starboardReactions.createStarboardReaction(msg.id, userId).catch(noop);
// If the message has already been posted to this starboard, we don't need to do anything else
const starboardMessages = await this.starboardMessages.getMatchingStarboardMessages(starboard.channel_id, msg.id);