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

18 lines
723 B
TypeScript

import { GuildScheduledEvent } from "discord.js"
import { repetitionMarkerIsFound } from "../handler/repeatingEvents/helper"
import { handleRepeatingEvent } from "../handler/repeatingEvents/repeatingEvents.controller"
export const name = 'guildScheduledEventUpdate'
export function execute(oldguildScheduledEvent: GuildScheduledEvent, newguildScheduledEvent: GuildScheduledEvent) {
console.dir(oldguildScheduledEvent)
console.dir(newguildScheduledEvent)
if (oldguildScheduledEvent.description && repetitionMarkerIsFound(oldguildScheduledEvent.description)) {
// valid repeating event
if (newguildScheduledEvent.status === 'COMPLETED')
handleRepeatingEvent(oldguildScheduledEvent, newguildScheduledEvent)
}
}