Merge pull request 'Create option "none of that" in voting' (#48) from feat/#39_none_of_that into master

Reviewed-on: #48
This commit is contained in:
Sammy 2023-06-23 15:49:43 +02:00
commit 3298c7a244
1 changed files with 5 additions and 1 deletions

View File

@ -6,11 +6,13 @@ import { client, yavinJellyfinHandler } from "../..";
import { config } from "../configuration"; import { config } from "../configuration";
import { Maybe } from "../interfaces"; import { Maybe } from "../interfaces";
import { logger } from "../logger"; import { logger } from "../logger";
import { SemanticClassificationFormat } from "typescript";
export const name = 'guildScheduledEventCreate' export const name = 'guildScheduledEventCreate'
export enum Emotes { "1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "🔟" } export enum Emotes { "1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "🔟" }
export const NONE_OF_THAT = "❌"
export let task: ScheduledTask | undefined export let task: ScheduledTask | undefined
@ -40,11 +42,12 @@ export async function execute(event: GuildScheduledEvent) {
} }
const date = format(event.scheduledStartAt, "dd.MM") const date = format(event.scheduledStartAt, "dd.MM")
const time = format(event.scheduledStartAt, "HH:mm") const time = format(event.scheduledStartAt, "HH:mm")
let message = `[Abstimmung]\n<@&${config.bot.announcement_role}> Es gibt eine neue Abstimmung für die nächste Watchparty am ${date} um ${time}}! Stimme hierunter für den nächsten Film ab!\n` let message = `[Abstimmung]\n<@&${config.bot.announcement_role}> Es gibt eine neue Abstimmung für die nächste Watchparty am ${date} um ${time}! 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(Emotes[i]).concat(": ").concat(movies[i]).concat("\n")
} }
message = message.concat(NONE_OF_THAT).concat(": Wenn dir nichts davon gefällt.")
const options: MessageCreateOptions = { const options: MessageCreateOptions = {
allowedMentions: { parse: ["roles"]}, allowedMentions: { parse: ["roles"]},
@ -56,6 +59,7 @@ export async function execute(event: GuildScheduledEvent) {
for (let i = 0; i < movies.length; i++) { for (let i = 0; i < movies.length; i++) {
sentMessage.react(Emotes[i]) sentMessage.react(Emotes[i])
} }
sentMessage.react(NONE_OF_THAT)
// sentMessage.pin() //todo: uncomment when bot has permission to pin messages. Also update closepoll.ts to only fetch pinned messages // sentMessage.pin() //todo: uncomment when bot has permission to pin messages. Also update closepoll.ts to only fetch pinned messages
} }