Skip to content

GuildBanManager

GuildBanManager ⇐ Base

Represents a manager for handling guild bans.

Kind: global class
Extends: Base

new GuildBanManager(guildId, client)

Constructs a new instance of the class.

ParamTypeDescription
guildIdstringThe ID of the guild.
clientClientThe client instance.

guildBanManager.cache ⇒

Getter method for the cache property.

Kind: instance property of GuildBanManager
Returns: The Collection object representing the cache.

guildBanManager._add(bans, [guildId], [options]) ⇒ GuildBan | null

Adds a ban to the guild’s ban cache.

Kind: instance method of GuildBanManager
Returns: GuildBan | null - - The added GuildBan object, or null if the ban is

ParamTypeDefaultDescription
bansstring | GuildBanThe ban ID or GuildBan object to add.
[guildId]string”this.guildId”The ID of the guild to add the ban to.
[options]object{cache: true, force: false}Additional options for adding the ban.
[options.cache]booleantrueWhether to cache the ban.
[options.force]booleanfalseWhether to force adding the ban even if it already exists in the cache.

guildBanManager.create(user, [options]) ⇒ Promise.<GuildBan>

Creates a ban for a user in the guild.

Kind: instance method of GuildBanManager
Returns: Promise.<GuildBan> - A promise that resolves with the created GuildBan object.
Throws:

  • Error If the API request fails.
ParamTypeDescription
userstring | UserThe user to ban. Can be a user ID or a User object.
[options]ObjectAdditional options for the ban.
[options.reason]stringThe reason for the ban.

guildBanManager.remove(user, reason) ⇒ Promise.<Ban>

Removes a user from the ban list in the guild.

Kind: instance method of GuildBanManager
Returns: Promise.<Ban> - A promise that resolves with the ban object of the removed user.

ParamTypeDescription
userstring | UserThe user to remove from the ban list. Can be a user ID or a User object.
reasonstringThe reason for removing the user from the ban list.

guildBanManager.fetch(ban, options) ⇒ Promise.<object>

Fetches ban information from the server.

Kind: instance method of GuildBanManager
Returns: Promise.<object> - - A promise that resolves to the fetched ban information.

ParamTypeDescription
banstring | objectThe ban ID or ban object.
optionsobjectAdditional options for the fetch.
options.cachebooleanWhether to use cached data.
options.forcebooleanWhether to force a fresh fetch.

guildBanManager._fetchId(ban, [cache], [force]) ⇒ Promise.<object>

Fetches the ID of a ban from the server.

Kind: instance method of GuildBanManager
Returns: Promise.<object> - - The fetched ban object.

ParamTypeDefaultDescription
banstring | objectThe ban object or the ID of the ban.
[cache]booleantrueWhether to cache the fetched ban.
[force]booleanfalseWhether to force fetching the ban even if it is already cached.

GuildBanManager.transformPayloadd(o) ⇒ Object

Transforms the payload object for deleting messages.

Kind: static method of GuildBanManager
Returns: Object - The transformed payload object.
Throws:

  • RangeError If the days value is less than 0 or greater than 7.
ParamTypeDescription
oObjectThe payload object.
o.daysnumberThe number of days to delete messages.