mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
* chore: consistency/prettier * chore: rebase * chore: rebase * chore: include typings * fix: include typings file in prettier lint-staged
31 lines
738 B
JavaScript
31 lines
738 B
JavaScript
'use strict';
|
|
|
|
const Action = require('./Action');
|
|
const { Events } = require('../../util/Constants');
|
|
|
|
class GuildRoleDeleteAction extends Action {
|
|
handle(data) {
|
|
const client = this.client;
|
|
const guild = client.guilds.cache.get(data.guild_id);
|
|
let role;
|
|
|
|
if (guild) {
|
|
role = guild.roles.cache.get(data.role_id);
|
|
if (role) {
|
|
guild.roles.cache.delete(data.role_id);
|
|
role.deleted = true;
|
|
/**
|
|
* Emitted whenever a guild role is deleted.
|
|
* @event Client#roleDelete
|
|
* @param {Role} role The role that was deleted
|
|
*/
|
|
client.emit(Events.GUILD_ROLE_DELETE, role);
|
|
}
|
|
}
|
|
|
|
return { role };
|
|
}
|
|
}
|
|
|
|
module.exports = GuildRoleDeleteAction;
|