19 lines
729 B
TypeScript
19 lines
729 B
TypeScript
import { GuildScheduledEvent } from "discord.js"
|
|
import { handleRepeatingEvent } from "../handler/repeatingEvents/repeatingEvents.controller"
|
|
|
|
|
|
const repetitionMarkerIsFound = (desc: string): boolean => desc.includes('$rep')
|
|
|
|
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)
|
|
}
|
|
}
|
|
|