DiscordLua
discorddiscord
v1.2.4
Install

GuildBanManager

Manager
On this page

GuildBanManager is the cache and REST facade for GuildBan objects owned by the parent. Typical calls are fetch, create, edit, delete, resolve, and resolveId.

manager Module 1.2.4 REST Source

Constructor

GuildBanManager.new(client, guild)

The class table is callable, so GuildBanManager(client, guild) is the same as .new.

NameTypeRequiredBehavior
client any required Passed through to the implementation as written.
guild any required Passed through to the implementation as written.
lua
local discord = require("discord")
local object = discord.GuildBanManager({}, {})

Properties

GuildBanManager.guild

# readonly
Name
guild
Type
any
Access
readonly
Description
Guild this GuildBanManager belongs to, when the payload included a guild id.
Availability
Populated from the Gateway/REST payload or constructor for this GuildBanManager.

Methods

GuildBanManager:bulkCreate()

#

Performs bulk create on this GuildBanManager. Call it from bot code when you need that operation on the current object.

Signature

GuildBanManager:bulkCreate(users, options, callback)

Parameters

NameTypeRequiredBehavior
users any required Passed through to the implementation as written.
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

GuildBanManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a GuildBanManager
object:bulkCreate(users, {}, function(err, result)
    if err then error(err) end
end)

GuildBanManager:create()

#

Create a new resource through REST and cache the result.

Signature

GuildBanManager:create(user, options, callback)

Parameters

NameTypeRequiredBehavior
user any required Passed through to the implementation as written.
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

GuildBanManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a GuildBanManager
object:create(user, {}, function(err, result)
    if err then error(err) end
end)

GuildBanManager:fetch()

#

Request a fresh copy of this resource from REST and update the cache.

Signature

GuildBanManager:fetch(userId, callback)

Parameters

NameTypeRequiredBehavior
userId string required Snowflake id string.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

GuildBanManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a GuildBanManager
object:fetch("123", function(err, result)
    if err then error(err) end
end)

GuildBanManager:remove()

#

Remove an item from this GuildBanManager.

Signature

GuildBanManager:remove(user, reason, callback)

Parameters

NameTypeRequiredBehavior
user any required Passed through to the implementation as written.
reason string optional Audit-log reason sent as X-Audit-Log-Reason on REST mutations.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

GuildBanManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a GuildBanManager
object:remove(user, reason, function(err, result)
    if err then error(err) end
end)

GuildBanManager:resolveId()

#

Resolve a snowflake, object, or mention to an id string.

Signature

GuildBanManager:resolveId(userOrBan)

Parameters

NameTypeRequiredBehavior
userOrBan any required Passed through to the implementation as written.

Returns

GuildBanManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a GuildBanManager
object:resolveId(userOrBan)

Examples

lua
local discord = require("discord")
local object = discord.GuildBanManager({})

ApplicationCommandManager · ApplicationCommandPermissionsManager · ApplicationEmojiManager · AutoModerationRuleManager · BaseGuildEmojiManager · BaseManager · CachedManager · CategoryChannelChildManager

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc