fix/movie_names_and_background_task #46

Merged
kenobi merged 5 commits from fix/movie_names_and_background_task into master 2023-06-19 11:29:04 +02:00
2 changed files with 10 additions and 2 deletions
Showing only changes of commit 4cc332820f - Show all commits

View File

@ -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())) {
kenobi marked this conversation as resolved Outdated

This would also meant that it is not possible to start an impromptu poll for a Watchparty 'tonight'.
Maybe it's possible to also check if the post is older than 24 hours?

This would also meant that it is not possible to start an impromptu poll for a Watchparty 'tonight'. Maybe it's possible to also check if the post is older than 24 hours?

I think this would better be solved by !noautoclose or something when making the !nextwp? Could be carried to the voting offen event or the message to parse for that?

I think this would better be solved by !noautoclose or something when making the !nextwp? Could be carried to the voting offen event or the message to parse for that?

This would increase 'friction' I feel.
An easy thing for users to forget to do and be surprised by how the bot acts.
I would propose that we could do both.
If the distance between poll post date and event date is less than 2 days it does not auto close, but the poll creation would need to be adjusted to contain guidance on how to close the poll manually for the creator of the event.
'Normal' poll posts would be made a week in advance to a watch party so the 2-day auto close would be fine.

This would increase 'friction' I feel. An easy thing for users to forget to do and be surprised by how the bot acts. I would propose that we could do both. If the distance between poll post date and event date is less than 2 days it does not auto close, but the poll creation would need to be adjusted to contain guidance on how to close the poll manually for the creator of the event. 'Normal' poll posts would be made a week in advance to a watch party so the 2-day auto close would be fine.

Implemented check to see if less than or equal to two days between start and create date of event

Implemented check to see if less than or equal to two days between start and create date of event
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)

View File

@ -75,7 +75,7 @@ export class ExtendedClient extends Client {
this.cacheUsers(guilds)
await this.cacheAnnouncementServer(guilds)
this.startAnnouncementRoleBackgroundTask(guilds)
this.startPollCloceBackgroundTasks()
this.startPollCloseBackgroundTasks()
})
} catch (error) {
logger.info(`Error refreshing slash commands: ${error}`)
@ -173,7 +173,7 @@ export class ExtendedClient extends Client {
task.stop()
}
private async startPollCloceBackgroundTasks() {
private async startPollCloseBackgroundTasks() {
kenobi marked this conversation as resolved Outdated

startPollCloseBackgroundTask

startPollClo**s**eBackgroundTask

fixed

fixed
for(const guild of this.guilds.cache) {
this.pollCloseBackgroundTasks.set(guild[1].id, schedule("0 * * * * *", () => checkForPollsToClose(guild[1])))
}