3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 20:35:02 +00:00

Add locks to starboard and include example of level-only starring (#125)

This commit is contained in:
Nils 2020-12-20 17:32:24 +01:00 committed by GitHub
parent adc8959836
commit b2a53b0722
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View file

@ -58,6 +58,7 @@ export const StarboardReactionAddEvt = starboardEvt({
});
for (const starboard of applicableStarboards) {
const boardLock = await pluginData.locks.acquire(`starboards-channel-${starboard.channel_id}`);
// Save reaction into the database
await pluginData.state.starboardReactions.createStarboardReaction(msg.id, userId).catch(noop);
@ -73,6 +74,7 @@ export const StarboardReactionAddEvt = starboardEvt({
if (reactionsCount >= starboard.stars_required) {
await saveMessageToStarboard(pluginData, msg, starboard);
}
boardLock.unlock();
}
},
});