GuildBanManager
GuildBanManager ⇐ Base
Section titled “GuildBanManager ⇐ Base”Represents a manager for handling guild bans.
Kind: global class
Extends: Base
- GuildBanManager ⇐
Base- new GuildBanManager(guildId, client)
- instance
- .cache ⇒
- ._add(bans, [guildId], [options]) ⇒
GuildBan|null - .create(user, [options]) ⇒
Promise.<GuildBan> - .remove(user, reason) ⇒
Promise.<Ban> - .fetch(ban, options) ⇒
Promise.<object> - ._fetchId(ban, [cache], [force]) ⇒
Promise.<object>
- static
- .transformPayloadd(o) ⇒
Object
- .transformPayloadd(o) ⇒
new GuildBanManager(guildId, client)
Section titled “new GuildBanManager(guildId, client)”Constructs a new instance of the class.
| Param | Type | Description |
|---|---|---|
| guildId | string | The ID of the guild. |
| client | Client | The client instance. |
guildBanManager.cache ⇒
Section titled “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
Section titled “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
| Param | Type | Default | Description |
|---|---|---|---|
| bans | string | GuildBan | The 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] | boolean | true | Whether to cache the ban. |
| [options.force] | boolean | false | Whether to force adding the ban even if it already exists in the cache. |
guildBanManager.create(user, [options]) ⇒ Promise.<GuildBan>
Section titled “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:
ErrorIf the API request fails.
| Param | Type | Description |
|---|---|---|
| user | string | User | The user to ban. Can be a user ID or a User object. |
| [options] | Object | Additional options for the ban. |
| [options.reason] | string | The reason for the ban. |
guildBanManager.remove(user, reason) ⇒ Promise.<Ban>
Section titled “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.
| Param | Type | Description |
|---|---|---|
| user | string | User | The user to remove from the ban list. Can be a user ID or a User object. |
| reason | string | The reason for removing the user from the ban list. |
guildBanManager.fetch(ban, options) ⇒ Promise.<object>
Section titled “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.
| Param | Type | Description |
|---|---|---|
| ban | string | object | The ban ID or ban object. |
| options | object | Additional options for the fetch. |
| options.cache | boolean | Whether to use cached data. |
| options.force | boolean | Whether to force a fresh fetch. |
guildBanManager._fetchId(ban, [cache], [force]) ⇒ Promise.<object>
Section titled “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.
| Param | Type | Default | Description |
|---|---|---|---|
| ban | string | object | The ban object or the ID of the ban. | |
| [cache] | boolean | true | Whether to cache the fetched ban. |
| [force] | boolean | false | Whether to force fetching the ban even if it is already cached. |
GuildBanManager.transformPayloadd(o) ⇒ Object
Section titled “GuildBanManager.transformPayloadd(o) ⇒ Object”Transforms the payload object for deleting messages.
Kind: static method of GuildBanManager
Returns: Object - The transformed payload object.
Throws:
RangeErrorIf the days value is less than 0 or greater than 7.
| Param | Type | Description |
|---|---|---|
| o | Object | The payload object. |
| o.days | number | The number of days to delete messages. |