ApplicationCommandManager
ManagerOn this page
ApplicationCommandManager is the cache and REST facade for ApplicationCommand objects owned by the parent. Typical calls are fetch, create, edit, delete, resolve, and resolveId.
Constructor
ApplicationCommandManager.new(client, guild) The class table is callable, so ApplicationCommandManager(client, guild) is the same as .new.
| Name | Type | Required | Behavior |
|---|---|---|---|
client |
any |
required | Passed through to the implementation as written. |
guild |
any |
required | Passed through to the implementation as written. |
local discord = require("discord")
local object = discord.ApplicationCommandManager({}, {})Properties
- Name
guild- Type
any- Access
- readonly
- Description
- Guild this ApplicationCommandManager belongs to, when the payload included a guild id.
- Availability
- Populated from the Gateway/REST payload or constructor for this ApplicationCommandManager.
- Name
permissions- Type
- ApplicationCommandPermissionsManager
- Access
- readonly
- Description
- Cache and REST facade for applicationcommandpermissions objects owned by this ApplicationCommandManager. Use it to fetch, create, resolve, and mutate those resources.
- Availability
- Created in
ApplicationCommandManager.newand remains valid for the lifetime of the ApplicationCommandManager. - Related
- ApplicationCommandPermissionsManager
Methods
ApplicationCommandManager:applicationId()
#Performs application id on this ApplicationCommandManager. Call it from bot code when you need that operation on the current object.
Signature
ApplicationCommandManager:applicationId() Parameters
No parameters.
Returns
ApplicationCommandManager — the same instance, for chaining.
Throws
A DiscordLua error when arguments are invalid or the request fails without a callback.
Example
local discord = require("discord")
-- object is a ApplicationCommandManager
object:applicationId()ApplicationCommandManager:create()
#Create a new resource through REST and cache the result.
Signature
ApplicationCommandManager:create(command, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
command |
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
ApplicationCommandManager — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ApplicationCommandManager
object:create(command, function(err, result)
if err then error(err) end
end)ApplicationCommandManager:delete()
#Permanently delete this resource through REST.
Signature
ApplicationCommandManager:delete(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
ApplicationCommandManager — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ApplicationCommandManager
object:delete("123", function(err, result)
if err then error(err) end
end)ApplicationCommandManager:edit()
#Apply a REST update to this resource.
Signature
ApplicationCommandManager:edit(id, options, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
id |
string |
required | Snowflake id string. |
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
ApplicationCommandManager — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ApplicationCommandManager
object:edit("123", {}, function(err, result)
if err then error(err) end
end)Performs encode on this ApplicationCommandManager. Call it from bot code when you need that operation on the current object.
Signature
ApplicationCommandManager.encode(command) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
command |
any |
required | Passed through to the implementation as written. |
Returns
ApplicationCommandManager — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ApplicationCommandManager
ApplicationCommandManager.encode(command)ApplicationCommandManager:fetch()
#Request a fresh copy of this resource from REST and update the cache.
Signature
ApplicationCommandManager:fetch(idOrOptions, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
idOrOptions |
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
ApplicationCommandManager — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ApplicationCommandManager
object:fetch({}, function(err, result)
if err then error(err) end
end)ApplicationCommandManager:path()
#Performs path on this ApplicationCommandManager. Call it from bot code when you need that operation on the current object.
Signature
ApplicationCommandManager:path(id) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
id |
string |
required | Snowflake id string. |
Returns
ApplicationCommandManager — the same instance, for chaining.
Throws
A DiscordLua error when arguments are invalid or the request fails without a callback.
Example
local discord = require("discord")
-- object is a ApplicationCommandManager
object:path("123")ApplicationCommandManager:set()
#Performs set on this ApplicationCommandManager. Call it from bot code when you need that operation on the current object.
Signature
ApplicationCommandManager:set(commands, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
commands |
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
ApplicationCommandManager — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ApplicationCommandManager
object:set(commands, function(err, result)
if err then error(err) end
end)Static members
-
ApplicationCommandManager.GuildApplicationCommandManager
Examples
local discord = require("discord")
local object = discord.ApplicationCommandManager({})Related APIs
ApplicationCommandPermissionsManager · ApplicationEmojiManager · AutoModerationRuleManager · BaseGuildEmojiManager · BaseManager · CachedManager · CategoryChannelChildManager · ChannelManager
Version: discord 1.2.4 · runtime 1.0.0