use repetitionstring validator in new and updated events
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
b22cb1167d
commit
790a0d65f4
@ -1,8 +1,10 @@
|
|||||||
import { GuildScheduledEvent } from 'discord.js'
|
import { GuildScheduledEvent } from 'discord.js'
|
||||||
|
import { validateRepetitionStringAndSendMessageOnFail } from '../handler/repeatingEvents/helper'
|
||||||
export const name = 'guildScheduledEventCreate'
|
export const name = 'guildScheduledEventCreate'
|
||||||
export function execute(guildScheduledEvent: GuildScheduledEvent) {
|
export async function execute(guildScheduledEvent: GuildScheduledEvent) {
|
||||||
try {
|
try {
|
||||||
console.log(`${JSON.stringify(guildScheduledEvent)} has been created.`)
|
console.log(`${JSON.stringify(guildScheduledEvent)} has been created.`)
|
||||||
|
validateRepetitionStringAndSendMessageOnFail(guildScheduledEvent)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,19 @@
|
|||||||
import { GuildScheduledEvent } from "discord.js"
|
import { GuildScheduledEvent } from "discord.js"
|
||||||
import { repetitionMarkerIsFound } from "../handler/repeatingEvents/helper"
|
import { config } from "../configuration"
|
||||||
|
import { repetitionMarkerIsFound, validateRepetitionStringAndSendMessageOnFail } from "../handler/repeatingEvents/helper"
|
||||||
import { handleRepeatingEvent } from "../handler/repeatingEvents/repeatingEvents.controller"
|
import { handleRepeatingEvent } from "../handler/repeatingEvents/repeatingEvents.controller"
|
||||||
|
|
||||||
|
|
||||||
export const name = 'guildScheduledEventUpdate'
|
export const name = 'guildScheduledEventUpdate'
|
||||||
export function execute(oldguildScheduledEvent: GuildScheduledEvent, newguildScheduledEvent: GuildScheduledEvent) {
|
export function execute(oldguildScheduledEvent: GuildScheduledEvent, newguildScheduledEvent: GuildScheduledEvent) {
|
||||||
|
if (config.debug) {
|
||||||
console.dir(oldguildScheduledEvent)
|
console.dir(oldguildScheduledEvent)
|
||||||
console.dir(newguildScheduledEvent)
|
console.dir(newguildScheduledEvent)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oldguildScheduledEvent.description !== newguildScheduledEvent.description) {
|
||||||
|
validateRepetitionStringAndSendMessageOnFail(newguildScheduledEvent)
|
||||||
|
}
|
||||||
if (oldguildScheduledEvent.description && repetitionMarkerIsFound(oldguildScheduledEvent.description)) {
|
if (oldguildScheduledEvent.description && repetitionMarkerIsFound(oldguildScheduledEvent.description)) {
|
||||||
// valid repeating event
|
// valid repeating event
|
||||||
if (newguildScheduledEvent.status === 'COMPLETED')
|
if (newguildScheduledEvent.status === 'COMPLETED')
|
||||||
|
Loading…
Reference in New Issue
Block a user