feat/40-reroll-on-disinterest #54
@ -10,24 +10,19 @@ export default class VoteController {
|
||||
|
||||
public async handleNoneOfThatVote(messageReaction: MessageReaction, user: User, reactedUponMessage: Message, requestId: string, guildId: string) {
|
||||
if (!messageReaction.message.guild) return 'No guild'
|
||||
if (messageIsVoteMessage(reactedUponMessage)) {
|
||||
logger.debug(`${reactedUponMessage.id} is vote message`, { requestId, guildId })
|
||||
if (messageReaction.message.reactions.cache.find(reaction => reaction.emoji.toString() == NONE_OF_THAT)) {
|
||||
const watcherRoleMember = await getMembersWithRoleFromGuild(config.bot.announcement_role, messageReaction.message.guild)
|
||||
logger.info("ROLE MEMBERS " + JSON.stringify(watcherRoleMember), { requestId, guildId })
|
||||
const watcherRoleMemberCount = watcherRoleMember.size
|
||||
logger.info(`MEMBER COUNT: ${watcherRoleMemberCount}`, { requestId, guildId })
|
||||
let noneOfThatReactions = messageReaction.message.reactions.cache.get(NONE_OF_THAT)?.users.cache.filter(x => x.id !== client.user?.id).size ?? 0
|
||||
logger.debug(`${reactedUponMessage.id} is vote message`, { requestId, guildId })
|
||||
kenobi marked this conversation as resolved
Outdated
|
||||
const watcherRoleMember = await getMembersWithRoleFromGuild(config.bot.announcement_role, messageReaction.message.guild)
|
||||
logger.info("ROLE MEMBERS " + JSON.stringify(watcherRoleMember), { requestId, guildId })
|
||||
kenobi marked this conversation as resolved
Outdated
magnetotail
commented
duplicate check. already checked before call in handleMessageReactionAdd duplicate check. already checked before call in handleMessageReactionAdd
kenobi
commented
removed removed
|
||||
const watcherRoleMemberCount = watcherRoleMember.size
|
||||
logger.info(`MEMBER COUNT: ${watcherRoleMemberCount}`, { requestId, guildId })
|
||||
let noneOfThatReactions = messageReaction.message.reactions.cache.get(NONE_OF_THAT)?.users.cache.filter(x => x.id !== client.user?.id).size ?? 0
|
||||
|
||||
const memberThreshold = (watcherRoleMemberCount / 2)
|
||||
logger.info(`Reroll ${noneOfThatReactions} > ${memberThreshold} ?`, { requestId, guildId })
|
||||
if (noneOfThatReactions > memberThreshold) {
|
||||
logger.info('Starting poll reroll', { requestId, guildId })
|
||||
messageReaction.message.edit((messageReaction.message.content ?? "").concat('\nDiese Abstimmung muss wiederholt werden.'))
|
||||
}
|
||||
logger.info(`No reroll`, { requestId, guildId })
|
||||
}
|
||||
const memberThreshold = (watcherRoleMemberCount / 2)
|
||||
logger.info(`Reroll ${noneOfThatReactions} > ${memberThreshold} ?`, { requestId, guildId })
|
||||
if (noneOfThatReactions > memberThreshold) {
|
||||
logger.info('Starting poll reroll', { requestId, guildId })
|
||||
messageReaction.message.edit((messageReaction.message.content ?? "").concat('\nDiese Abstimmung muss wiederholt werden.'))
|
||||
}
|
||||
|
||||
logger.info(`No reroll`, { requestId, guildId })
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user
Move check to handleMessageReactionAdd
moved