SnowflakeUtil
ClassOn this page
SnowflakeUtil 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 deconstruct on this SnowflakeUtil. Call it from bot code when you need that operation on the current object.
Signature
SnowflakeUtil.deconstruct(id) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
id |
string |
required | Snowflake id string. |
Returns
SnowflakeUtil — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SnowflakeUtil
SnowflakeUtil.deconstruct("123")Performs generate on this SnowflakeUtil. Call it from bot code when you need that operation on the current object.
Signature
SnowflakeUtil.generate(options) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
options |
table |
optional | Lua option table. Field names match the corresponding DiscordLua option type when one exists. |
Returns
SnowflakeUtil — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SnowflakeUtil
SnowflakeUtil.generate({})Predicate that returns whether this SnowflakeUtil matches isSnowflake. Use it to branch before calling type-specific methods.
Signature
SnowflakeUtil.isSnowflake(id) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
id |
string |
required | Snowflake id string. |
Returns
SnowflakeUtil — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SnowflakeUtil
SnowflakeUtil.isSnowflake("123")Performs timestamp on this SnowflakeUtil. Call it from bot code when you need that operation on the current object.
Signature
SnowflakeUtil.timestamp(id) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
id |
string |
required | Snowflake id string. |
Returns
SnowflakeUtil — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SnowflakeUtil
SnowflakeUtil.timestamp("123")Static members
-
SnowflakeUtil.EPOCH -
SnowflakeUtil.decode -
SnowflakeUtil.epoch -
SnowflakeUtil.processId -
SnowflakeUtil.timestampFrom -
SnowflakeUtil.workerId
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 · ApplicationCommandNumericOptionMinMaxValueMixin · ApplicationCommandOptionBase
Version: discord 1.2.9 · runtime 1.0.0