'use strict';

const { Events } = require('../../../util/Events.js');

module.exports = (client, { d: data }) => {
  const guild = client.guilds.cache.get(data.guild_id);
  if (!guild) return;

  /**
   * Emitted whenever a member is banned from a guild.
   *
   * @event Client#guildBanAdd
   * @param {GuildBan} ban The ban that occurred
   */
  client.emit(Events.GuildBanAdd, guild.bans._add(data));
};
