feat/40-reroll-on-disinterest #54
@ -1,6 +1,7 @@
|
||||
|
||||
export enum Emotes { "1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟" }
|
||||
export enum ValidVoteEmotes { "1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟" }
|
||||
export const NONE_OF_THAT = "❌"
|
||||
magnetotail marked this conversation as resolved
|
||||
// WIP
|
||||
export const Emoji = {
|
||||
"one": "\u0031\uFE0F\u20E3",
|
||||
"two": "\u0032\uFE0F\u20E3",
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
kenobi marked this conversation as resolved
magnetotail
commented
Rename file to something like "handleVoteReaction" to make it separate from future reactionadd handlers Rename file to something like "handleVoteReaction" to make it separate from future reactionadd handlers
kenobi
commented
Agreement to use handleMessageReactionAdd as a 'reaction pre processor' to hand off reaction emoji to other handling methods and keep the eventHandler itself generic. Agreement to use handleMessageReactionAdd as a 'reaction pre processor' to hand off reaction emoji to other handling methods and keep the eventHandler itself generic.
|
||||
import { Message, MessageReaction, User } from "discord.js";
|
||||
import { logger, newRequestId, noGuildId } from "../logger";
|
||||
import { Emoji, Emotes, NONE_OF_THAT } from "../constants";
|
||||
import { Emoji, ValidVoteEmotes, NONE_OF_THAT } from "../constants";
|
||||
import { client } from "../..";
|
||||
import { isInitialAnnouncement, isVoteMessage } from "../helper/messageIdentifiers";
|
||||
|
||||
@ -26,7 +26,7 @@ export async function execute(messageReaction: MessageReaction, user: User) {
|
||||
|
||||
logger.info(`emoji: ${messageReaction.emoji.toString()}`)
|
||||
|
||||
if (!Object.values(Emotes).includes(messageReaction.emoji.toString()) && messageReaction.emoji.toString() !== NONE_OF_THAT) {
|
||||
if (!Object.values(ValidVoteEmotes).includes(messageReaction.emoji.toString()) && messageReaction.emoji.toString() !== NONE_OF_THAT) {
|
||||
logger.info(`${messageReaction.emoji.toString()} currently not handled`)
|
||||
return
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Guild, GuildScheduledEvent, GuildScheduledEventEditOptions, GuildScheduledEventSetStatusArg, GuildScheduledEventStatus, Message, MessageCreateOptions, MessageReaction, TextChannel } from "discord.js"
|
||||
import { Emotes, NONE_OF_THAT } from "../constants"
|
||||
import { ValidVoteEmotes, NONE_OF_THAT } from "../constants"
|
||||
import { logger, newRequestId } from "../logger"
|
||||
import { getMembersWithRoleFromGuild } from "./roleFilter"
|
||||
import { config } from "../configuration"
|
||||
@ -187,7 +187,7 @@ export default class VoteController {
|
||||
let message = `[Abstimmung] für https://discord.com/events/${guildId}/${event.id} \n<@&${config.bot.announcement_role}> Es gibt eine neue Abstimmung für die nächste Watchparty ${createDateStringFromEvent(event.scheduledStartAt, guildId, requestId)}! Stimme hierunter für den nächsten Film ab!\n`
|
||||
|
||||
for (let i = 0; i < movies.length; i++) {
|
||||
message = message.concat(Emotes[i]).concat(": ").concat(movies[i]).concat("\n")
|
||||
message = message.concat(ValidVoteEmotes[i]).concat(": ").concat(movies[i]).concat("\n")
|
||||
}
|
||||
message = message.concat(NONE_OF_THAT).concat(": Wenn dir nichts davon gefällt.")
|
||||
|
||||
@ -205,7 +205,7 @@ export default class VoteController {
|
||||
const sentMessage: Message<true> = await (await announcementChannel.fetch()).send(options)
|
||||
|
||||
for (let i = 0; i < movieCount; i++) {
|
||||
sentMessage.react(Emotes[i])
|
||||
sentMessage.react(ValidVoteEmotes[i])
|
||||
}
|
||||
sentMessage.react(NONE_OF_THAT)
|
||||
|
||||
@ -260,9 +260,9 @@ export default class VoteController {
|
||||
*/
|
||||
public async getVotesByEmote(message: VoteMessage, guildId: string, requestId: string): Promise<Vote[]> {
|
||||
const votes: Vote[] = []
|
||||
magnetotail marked this conversation as resolved
magnetotail
commented
should be renamed so it's clear what the event gets updated with and what it looks like in the end and what kind of event gets updated (I guess open poll events) should be renamed so it's clear what the event gets updated with and what it looks like in the end and what kind of event gets updated (I guess open poll events)
kenobi
commented
ca99987a
done
|
||||
logger.debug(`Number of items in emotes: ${Object.values(Emotes).length}`, { guildId, requestId })
|
||||
for (let i = 0; i < Object.keys(Emotes).length / 2; i++) {
|
||||
const emote = Emotes[i]
|
||||
logger.debug(`Number of items in emotes: ${Object.values(ValidVoteEmotes).length}`, { guildId, requestId })
|
||||
for (let i = 0; i < Object.keys(ValidVoteEmotes).length / 2; i++) {
|
||||
const emote = ValidVoteEmotes[i]
|
||||
logger.debug(`Getting reaction for emote ${emote}`, { guildId, requestId })
|
||||
const reaction = message.reactions.resolve(emote)
|
||||
logger.debug(`Reaction for emote ${emote}: ${JSON.stringify(reaction, null, 2)}`, { guildId, requestId })
|
||||
|
Loading…
Reference in New Issue
Block a user
Can this be integrated into Emoji? Maybe provide method to only get number emojis then? By definition "NONE_OF_THAT" is also an emoji
Emotes got renamed to validVoteEmotes
fb4ab59dc6
preliminary solution