node-event-bot/server/events/guildScheduledEventUpdate.ts

18 lines
723 B
TypeScript
Raw Normal View History

import { GuildScheduledEvent } from "discord.js"
2022-04-21 19:46:03 +02:00
import { repetitionMarkerIsFound } from "../handler/repeatingEvents/helper"
import { handleRepeatingEvent } from "../handler/repeatingEvents/repeatingEvents.controller"
2022-03-05 01:24:05 +01:00
export const name = 'guildScheduledEventUpdate'
2022-04-12 22:39:47 +02:00
export function execute(oldguildScheduledEvent: GuildScheduledEvent, newguildScheduledEvent: GuildScheduledEvent) {
console.dir(oldguildScheduledEvent)
console.dir(newguildScheduledEvent)
if (oldguildScheduledEvent.description && repetitionMarkerIsFound(oldguildScheduledEvent.description)) {
2022-04-12 22:39:47 +02:00
// valid repeating event
if (newguildScheduledEvent.status === 'COMPLETED')
handleRepeatingEvent(oldguildScheduledEvent, newguildScheduledEvent)
2022-04-12 22:39:47 +02:00
}
}