Skip to content

Commit

Permalink
implemented fix for #477
Browse files Browse the repository at this point in the history
  • Loading branch information
jcolson committed Dec 19, 2021
1 parent d931ec5 commit 108751f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions handlers/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,16 @@ async function handleReactionAdd(reaction, user, guildConfig) {
let eventForMessage = await EventModel.findOne({ guildID: reaction.message.guild.id, channelID: reaction.message.channel.id, messageID: reaction.message.id });
if (!eventForMessage) {
console.info('handleReactionAdd: Did not find event for reaction.');
} else {
// scrub users that are no longer on server
await eventForMessage.attendees.forEach(async (attendee, index) => {
let attendeeUser = await reaction.message.guild.members.resolve(attendee.userID);
if (!attendeeUser) {
console.debug(`handleReactionAdd: removing an attendee that is no longer in guild: ${attendee.userID}`);
eventForMessage.attendees.splice(index, 1);
}
});
await eventForMessage.save();
}
if (reaction.emoji?.name == utils.EMOJIS.CHECK && eventForMessage) {
await attendeeAdd(reaction.message, user, eventForMessage, guildConfig);
Expand Down

0 comments on commit 108751f

Please sign in to comment.