DiscordLua
discorddiscord
v1.2.4
Install

GuildManager

Manager
On this page

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

manager Module 1.2.4 REST Source

Constructor

GuildManager.new(client)

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

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

Methods

GuildManager:create()

#

Create a new resource through REST and cache the result.

Signature

GuildManager:create(options, callback)

Parameters

NameTypeRequiredBehavior
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

GuildManager — the same instance, for chaining.

Example

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

GuildManager:delete()

#

Permanently delete this resource through REST.

Signature

GuildManager:delete(guild, callback)

Parameters

NameTypeRequiredBehavior
guild any required Passed through to the implementation as written.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

GuildManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a GuildManager
object:delete(guild, function(err, result)
    if err then error(err) end
end)

GuildManager:fetch()

#

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

Signature

GuildManager:fetch(id, callback)

Parameters

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

Returns

GuildManager — the same instance, for chaining.

Example

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

GuildManager:fetchSoundboardSounds()

#

Fetch SoundboardSounds from REST and update the local cache when the request succeeds.

Signature

GuildManager:fetchSoundboardSounds(options, callback)

Parameters

NameTypeRequiredBehavior
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

any.

Example

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

GuildManager:setIncidentActions()

#

Set the IncidentActions field. Builders return this GuildManager so setters can be chained.

Signature

GuildManager:setIncidentActions(guild, actions, callback)

Parameters

NameTypeRequiredBehavior
guild any required Passed through to the implementation as written.
actions any required Passed through to the implementation as written.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

GuildManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a GuildManager
object:setIncidentActions(guild, actions, function(err, result)
    if err then error(err) end
end)

GuildManager:widgetImageURL()

#

Performs widget image url on this GuildManager. Call it from bot code when you need that operation on the current object.

Signature

GuildManager:widgetImageURL(guild, style)

Parameters

NameTypeRequiredBehavior
guild any required Passed through to the implementation as written.
style any optional Passed through to the implementation as written.

Returns

GuildManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a GuildManager
object:widgetImageURL(guild, style)

Examples

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

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

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc