class GuildBanManager
extends
CachedManager<Snowflake, GuildBan, GuildBanResolvable>export class GuildBanManager extends CachedManager<Snowflake, GuildBan, GuildBanResolvable>
Manages API methods for guild bans and stores their cache.
Collection<Snowflake, GuildBan> cache :
The cache of this Manager
readonlyClient client :
The client that instantiated this Manager
Guild guild :
The guild this Manager belongs to
readonlyConstructable<Holds> holds :
The data structure belonging to this manager.
Inherited from: DataManager
createuser: UserResolvableoptions?: BanOptions) : Promise<GuildMember | User | Snowflake> (
user: UserResolvable
options?: BanOptions
Bans a user from the guild.
Examples:
// Ban a user by id (or with a user/guild member object)
guild.bans.create('84484653687267328')
.then(banInfo => console.log(`Banned ${banInfo.user?.tag ?? banInfo.tag ?? banInfo}`))
.catch(console.error);
Returns: Result object will be resolved as specifically as possible. If the GuildMember cannot be resolved, the User will instead be attempted to be resolved. If that also cannot be resolved, the user id will be the result.
Overload 1
Overload 2
fetchoptions: UserResolvable | FetchBanOptions) : Promise<GuildBan> (
options: UserResolvable | FetchBanOptions
Fetches ban(s) from Discord.
Examples:
// Fetch multiple bans from a guild
guild.bans.fetch()
.then(console.log)
.catch(console.error);
// Fetch a maximum of 5 bans from a guild without caching
guild.bans.fetch({ limit: 5, cache: false })
.then(console.log)
.catch(console.error);
// Fetch a single ban
guild.bans.fetch('351871113346809860')
.then(console.log)
.catch(console.error);
// Fetch a single ban without checking cache
guild.bans.fetch({ user, force: true })
.then(console.log)
.catch(console.error)
// Fetch a single ban without caching
guild.bans.fetch({ user, cache: false })
.then(console.log)
.catch(console.error);
removeuser: UserResolvablereason?: string) : Promise<User | null> (
user: UserResolvable
reason?: string
Unbans a user from the guild.
Examples:
// Unban a user by id (or with a user/guild member object)
guild.bans.remove('84484653687267328')
.then(user => console.log(`Unbanned ${user.username} from ${guild.name}`))
.catch(console.error);
resolveban: GuildBanResolvable) : GuildBan (
ban: GuildBanResolvable
Resolves a GuildBanResolvable to a GuildBan object.
Overload 1
Overload 2
valueOfCollection<Key, Holds> () :
Inherited from: DataManager