prevent poll close if event is less than 24h old
All checks were successful
Build a docker image for node-jellyfin-role-bot / build-docker-image (push) Successful in 1m15s
All checks were successful
Build a docker image for node-jellyfin-role-bot / build-docker-image (push) Successful in 1m15s
This commit is contained in:
@ -164,6 +164,14 @@ export async function checkForPollsToClose(guild: Guild): Promise<void> {
|
||||
return
|
||||
}
|
||||
|
||||
const createDate: Date = toDate(updatedEvent.createdTimestamp)
|
||||
const closePollMinDate: Date = addDays(createDate, 1)
|
||||
|
||||
if(isAfter(closePollMinDate, Date.now())) {
|
||||
logger.info("Event is less than 24h old. Not closing poll!", { guildId: guild.id, requestId })
|
||||
return
|
||||
}
|
||||
|
||||
const eventDate: Date = toDate(updatedEvent.scheduledStartTimestamp)
|
||||
const closePollDate: Date = addDays(eventDate, -2)
|
||||
|
||||
|
Reference in New Issue
Block a user