mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com> Co-authored-by: izexi <43889168+izexi@users.noreply.github.com> Co-authored-by: Shubham Parihar <shubhamparihar391@gmail.com>
26 lines
717 B
JavaScript
26 lines
717 B
JavaScript
'use strict';
|
|
|
|
const Action = require('./Action');
|
|
const GuildBan = require('../../structures/GuildBan');
|
|
const { Events } = require('../../util/Constants');
|
|
|
|
class GuildBanRemove extends Action {
|
|
handle(data) {
|
|
const client = this.client;
|
|
const guild = client.guilds.cache.get(data.guild_id);
|
|
|
|
/**
|
|
* Emitted whenever a member is unbanned from a guild.
|
|
* @event Client#guildBanRemove
|
|
* @param {GuildBan} ban The ban that was removed
|
|
*/
|
|
if (guild) {
|
|
const ban = guild.bans.cache.get(data.user.id) ?? new GuildBan(client, data, guild);
|
|
guild.bans.cache.delete(ban.user.id);
|
|
client.emit(Events.GUILD_BAN_REMOVE, ban);
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = GuildBanRemove;
|