GuildManager
ManagerOn 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.
Constructor
GuildManager.new(client) The class table is callable, so GuildManager(client) is the same as .new.
| Name | Type | Required | Behavior |
|---|---|---|---|
client |
any |
required | Passed through to the implementation as written. |
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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
local discord = require("discord")
-- object is a GuildManager
object:widgetImageURL(guild, style)Examples
local discord = require("discord")
local object = discord.GuildManager({})Related APIs
ApplicationCommandManager · ApplicationCommandPermissionsManager · ApplicationEmojiManager · AutoModerationRuleManager · BaseGuildEmojiManager · BaseManager · CachedManager · CategoryChannelChildManager
Version: discord 1.2.4 · runtime 1.0.0