Add automatic creation of vote message with random movies #16
@ -16,7 +16,7 @@ export default new Command({
|
||||
const guildId = command.guildId!
|
||||
logger.info("Got command for closing poll!", { guildId: guildId, requestId })
|
||||
if (!command.guild) {
|
||||
logger.error("No guild found in interaction. Cancelling closing request")
|
||||
logger.error("No guild found in interaction. Cancelling closing request", {guildId: guildId, requestId})
|
||||
command.followUp("Es gab leider ein Problem. Ich konnte deine Anfrage nicht bearbeiten :(")
|
||||
return
|
||||
}
|
||||
@ -68,6 +68,7 @@ async function updateMessage(movie: string, message: Message, guildId: string, r
|
||||
const options: MessageEditOptions = {
|
||||
content: body,
|
||||
}
|
||||
logger.info("Updating message.", {guildId: guildId, requestId})
|
||||
message.edit(options)
|
||||
|
||||
}
|
||||
@ -90,6 +91,7 @@ async function updateEvent(votes: Vote[], guild: Guild, guildId: string, request
|
||||
description: `!wp\nNummer 2: ${votes[1].movie} mit ${votes[1].count - 1} Stimmen\nNummer 3: ${votes[2].movie} mit ${votes[2].count - 1} Stimmen`
|
||||
}
|
||||
logger.debug(`Updating event: ${JSON.stringify(voteEvent, null, 2)}`, { guildId: guildId, requestId })
|
||||
logger.info("Updating event.", {guildId: guildId, requestId})
|
||||
voteEvent.edit(options)
|
||||
kenobi marked this conversation as resolved
|
||||
}
|
||||
|
||||
@ -101,7 +103,7 @@ type Vote = {
|
||||
|
||||
async function getVotesByEmote(message: Message, guildId: string, requestId: string): Promise<Vote[]> {
|
||||
const votes: Vote[] = []
|
||||
logger.debug(`Number of items in emotes: ${Object.values(Emotes).length}`)
|
||||
logger.debug(`Number of items in emotes: ${Object.values(Emotes).length}`, {guildId: guildId, requestId})
|
||||
for (let i = 0; i < Object.keys(Emotes).length / 2; i++) {
|
||||
const emote = Emotes[i]
|
||||
logger.debug(`Getting reaction for emote ${emote}`, { guildId: guildId, requestId })
|
||||
|
@ -27,7 +27,7 @@ export async function execute(event: GuildScheduledEvent) {
|
||||
logger.debug(`Movies: ${JSON.stringify(movies.map(movie => movie.name))}`, { guildId: event.guildId, requestId })
|
||||
|
||||
const channel: TextChannel = <TextChannel>(await event.guild?.channels.fetch())?.filter(channel => channel!.id === config.bot.announcement_channel_id).map((value, _) => value)[0] //todo: needs to be done less sketchy
|
||||
kenobi marked this conversation as resolved
kenobi
commented
Might present a good reason to fetch this channel during boot and keep it in a constant, so these kinds of searches don't have to be performed more than once. Might present a good reason to fetch this channel during boot and keep it in a constant, so these kinds of searches don't have to be performed more than once.
magnetotail
commented
fixed fixed
|
||||
logger.debug(`Found channel ${JSON.stringify(channel, null, 2)}`)
|
||||
logger.debug(`Found channel ${JSON.stringify(channel, null, 2)}`, { guildId: event.guildId, requestId })
|
||||
|
||||
let message = "[Abstimmung]\nEs gibt eine neue Abstimmung für die nächste Watchparty! Stimme hierunter für den nächsten Film ab!\n"
|
||||
|
||||
|
@ -248,7 +248,7 @@ export class JellyfinHandler {
|
||||
logger.info(`${count} random movies requested.`, { guildId: guildId, requestId })
|
||||
const allMovies = await this.getAllMovies(guildId, requestId)
|
||||
if (count >= allMovies.length) {
|
||||
logger.info(`${count} random movies requested but found only ${allMovies.length}. Returning all Movies.`)
|
||||
logger.info(`${count} random movies requested but found only ${allMovies.length}. Returning all Movies.`, { guildId: guildId, requestId })
|
||||
return allMovies
|
||||
}
|
||||
const movies: BaseItemDto[] = []
|
||||
|
Loading…
Reference in New Issue
Block a user
My EYES!
Sorry :( That's what you get with typing I guess?
All good :)