rename emotes to validvoteemotes
This commit is contained in:
parent
6d40930dc1
commit
fb4ab59dc6
@ -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 = "❌"
|
export const NONE_OF_THAT = "❌"
|
||||||
|
// WIP
|
||||||
export const Emoji = {
|
export const Emoji = {
|
||||||
"one": "\u0031\uFE0F\u20E3",
|
"one": "\u0031\uFE0F\u20E3",
|
||||||
"two": "\u0032\uFE0F\u20E3",
|
"two": "\u0032\uFE0F\u20E3",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import { Message, MessageReaction, User } from "discord.js";
|
import { Message, MessageReaction, User } from "discord.js";
|
||||||
import { logger, newRequestId, noGuildId } from "../logger";
|
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 { client } from "../..";
|
||||||
import { isInitialAnnouncement, isVoteMessage } from "../helper/messageIdentifiers";
|
import { isInitialAnnouncement, isVoteMessage } from "../helper/messageIdentifiers";
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ export async function execute(messageReaction: MessageReaction, user: User) {
|
|||||||
|
|
||||||
logger.info(`emoji: ${messageReaction.emoji.toString()}`)
|
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`)
|
logger.info(`${messageReaction.emoji.toString()} currently not handled`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Guild, GuildScheduledEvent, GuildScheduledEventEditOptions, GuildScheduledEventSetStatusArg, GuildScheduledEventStatus, Message, MessageCreateOptions, MessageReaction, TextChannel } from "discord.js"
|
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 { logger, newRequestId } from "../logger"
|
||||||
import { getMembersWithRoleFromGuild } from "./roleFilter"
|
import { getMembersWithRoleFromGuild } from "./roleFilter"
|
||||||
import { config } from "../configuration"
|
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`
|
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++) {
|
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.")
|
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)
|
const sentMessage: Message<true> = await (await announcementChannel.fetch()).send(options)
|
||||||
|
|
||||||
for (let i = 0; i < movieCount; i++) {
|
for (let i = 0; i < movieCount; i++) {
|
||||||
sentMessage.react(Emotes[i])
|
sentMessage.react(ValidVoteEmotes[i])
|
||||||
}
|
}
|
||||||
sentMessage.react(NONE_OF_THAT)
|
sentMessage.react(NONE_OF_THAT)
|
||||||
|
|
||||||
@ -260,9 +260,9 @@ export default class VoteController {
|
|||||||
*/
|
*/
|
||||||
public async getVotesByEmote(message: VoteMessage, guildId: string, requestId: string): Promise<Vote[]> {
|
public async getVotesByEmote(message: VoteMessage, guildId: string, requestId: string): Promise<Vote[]> {
|
||||||
const votes: Vote[] = []
|
const votes: Vote[] = []
|
||||||
logger.debug(`Number of items in emotes: ${Object.values(Emotes).length}`, { guildId, requestId })
|
logger.debug(`Number of items in emotes: ${Object.values(ValidVoteEmotes).length}`, { guildId, requestId })
|
||||||
for (let i = 0; i < Object.keys(Emotes).length / 2; i++) {
|
for (let i = 0; i < Object.keys(ValidVoteEmotes).length / 2; i++) {
|
||||||
const emote = Emotes[i]
|
const emote = ValidVoteEmotes[i]
|
||||||
logger.debug(`Getting reaction for emote ${emote}`, { guildId, requestId })
|
logger.debug(`Getting reaction for emote ${emote}`, { guildId, requestId })
|
||||||
const reaction = message.reactions.resolve(emote)
|
const reaction = message.reactions.resolve(emote)
|
||||||
logger.debug(`Reaction for emote ${emote}: ${JSON.stringify(reaction, null, 2)}`, { guildId, requestId })
|
logger.debug(`Reaction for emote ${emote}: ${JSON.stringify(reaction, null, 2)}`, { guildId, requestId })
|
||||||
|
Loading…
Reference in New Issue
Block a user