Starboard: use locks for checking reactions to avoid race conditions

This commit is contained in:
Dragory 2019-03-31 22:35:54 +03:00
parent dad7717688
commit b9b4e2e9ed

View file

@ -195,6 +195,7 @@ export class StarboardPlugin extends ZeppelinPlugin<IBasePluginConfig, IStarboar
* the required threshold. If they do, post the message in the starboard channel.
*/
@d.event("messageReactionAdd")
@d.lock("starboardReaction")
async onMessageReactionAdd(msg: Message, emoji: { id: string; name: string }) {
if (!msg.author) {
// Message is not cached, fetch it