DiscordLua
discorddiscord
v1.2.4
Install

SnowflakeUtil

Class
On 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.

class Module 1.2.4 Source

Methods

SnowflakeUtil.deconstruct()

# static

Performs deconstruct on this SnowflakeUtil. Call it from bot code when you need that operation on the current object.

Signature

SnowflakeUtil.deconstruct(id)

Parameters

NameTypeRequiredBehavior
id string required Snowflake id string.

Returns

SnowflakeUtil — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SnowflakeUtil
SnowflakeUtil.deconstruct("123")

SnowflakeUtil.generate()

# static

Performs generate on this SnowflakeUtil. Call it from bot code when you need that operation on the current object.

Signature

SnowflakeUtil.generate(timestamp)

Parameters

NameTypeRequiredBehavior
timestamp any required Passed through to the implementation as written.

Returns

SnowflakeUtil — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SnowflakeUtil
SnowflakeUtil.generate(timestamp)

SnowflakeUtil.isSnowflake()

# static

Predicate that returns whether this SnowflakeUtil matches isSnowflake. Use it to branch before calling type-specific methods.

Signature

SnowflakeUtil.isSnowflake(id)

Parameters

NameTypeRequiredBehavior
id string required Snowflake id string.

Returns

SnowflakeUtil — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SnowflakeUtil
SnowflakeUtil.isSnowflake("123")

SnowflakeUtil.timestamp()

# static

Performs timestamp on this SnowflakeUtil. Call it from bot code when you need that operation on the current object.

Signature

SnowflakeUtil.timestamp(id)

Parameters

NameTypeRequiredBehavior
id string required Snowflake id string.

Returns

SnowflakeUtil — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SnowflakeUtil
SnowflakeUtil.timestamp("123")

Examples

Obtain this object from a manager, wrap helper, or event payload — it is not constructed directly in typical bot code.

ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · Attachment

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc