fix incorrect log regarding update cancellation, fixes return type of function to use Maybe
This commit is contained in:
parent
4e9fe587b0
commit
6d40930dc1
@ -273,15 +273,15 @@ export default class VoteController {
|
|||||||
}
|
}
|
||||||
return votes
|
return votes
|
||||||
}
|
}
|
||||||
public async getOpenPollEvent(guild: Guild, guildId: string, requestId: string): Promise<GuildScheduledEvent | null> {
|
public async getOpenPollEvent(guild: Guild, guildId: string, requestId: string): Promise<Maybe<GuildScheduledEvent>> {
|
||||||
const voteEvents = (await guild.scheduledEvents.fetch())
|
const voteEvents = (await guild.scheduledEvents.fetch())
|
||||||
.map((value) => value)
|
.map((value) => value)
|
||||||
.filter(event => event.name.toLowerCase().includes("voting offen"))
|
.filter(event => event.name.toLowerCase().includes("voting offen"))
|
||||||
logger.debug(`Found events: ${JSON.stringify(voteEvents, null, 2)}`, { guildId, requestId })
|
logger.debug(`Found events: ${JSON.stringify(voteEvents, null, 2)}`, { guildId, requestId })
|
||||||
|
|
||||||
if (!voteEvents || voteEvents.length <= 0) {
|
if (!voteEvents || voteEvents.length <= 0) {
|
||||||
logger.error("Could not find vote event. Cancelling update!", { guildId, requestId })
|
logger.error("Could not find an open vote event.", { guildId, requestId })
|
||||||
return null
|
return
|
||||||
}
|
}
|
||||||
return voteEvents[0]
|
return voteEvents[0]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user