2022-03-19 10:37:45 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const Action = require('./Action');
|
2022-03-24 10:55:32 +00:00
|
|
|
const { Events } = require('../../util/Constants');
|
2022-03-19 10:37:45 +00:00
|
|
|
|
|
|
|
class GuildScheduledEventDeleteAction extends Action {
|
|
|
|
handle(data) {
|
|
|
|
const client = this.client;
|
|
|
|
const guild = client.guilds.cache.get(data.guild_id);
|
|
|
|
|
|
|
|
if (guild) {
|
|
|
|
const guildScheduledEvent = this.getScheduledEvent(data, guild);
|
|
|
|
if (guildScheduledEvent) {
|
|
|
|
guild.scheduledEvents.cache.delete(guildScheduledEvent.id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Emitted whenever a guild scheduled event is deleted.
|
|
|
|
* @event Client#guildScheduledEventDelete
|
|
|
|
* @param {GuildScheduledEvent} guildScheduledEvent The deleted guild scheduled event
|
|
|
|
*/
|
2022-03-24 10:55:32 +00:00
|
|
|
client.emit(Events.GUILD_SCHEDULED_EVENT_DELETE, guildScheduledEvent);
|
2022-03-19 10:37:45 +00:00
|
|
|
|
|
|
|
return { guildScheduledEvent };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = GuildScheduledEventDeleteAction;
|