Options
ClassOn this page
Options is a DiscordLua class representing a Discord resource. Obtain it from a manager, an event payload, or the constructor when one is documented below.
Methods
Performs cache everything on this Options. Call it from bot code when you need that operation on the current object.
Signature
Options.cacheEverything() Parameters
No parameters.
Returns
any.
Example
local discord = require("discord")
-- object is a Options
Options.cacheEverything()Performs cache limit on this Options. Call it from bot code when you need that operation on the current object.
Signature
Options.cacheLimit(resolved, managerName) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
resolved |
any |
required | Passed through to the implementation as written. |
managerName |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Options
Options.cacheLimit(resolved, managerName)Performs cache with limits on this Options. Call it from bot code when you need that operation on the current object.
Signature
Options.cacheWithLimits(settings) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
settings |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a Options
Options.cacheWithLimits(settings)Create Default through REST and cache the result when the request succeeds. Pass function(err, result) to handle failures without raising.
Signature
Options.createDefault() Parameters
No parameters.
Returns
any.
Example
local discord = require("discord")
-- object is a Options
Options.createDefault()Resolve a snowflake, object, or mention to a cached instance.
Signature
Options.resolve(userOptions) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
userOptions |
table |
optional | Lua option table. Field names match the corresponding DiscordLua option type when one exists. |
Returns
any.
Example
local discord = require("discord")
-- object is a Options
Options.resolve({})Static members
-
Options.DefaultMakeCacheSettings -
Options.DefaultSweeperSettings
Examples
Obtain this object from a manager, wrap helper, or event payload — it is not constructed directly in typical bot code.
Related APIs
ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · Attachment
Version: discord 1.2.4 · runtime 1.0.0