Snowflake

A unique identifier for entities used by Discord.

Snowflakes are IDs with a timestamp, which makes them comparable based on their timestamp.

Constructors

Link copied to clipboard
constructor(value: ULong)

Creates a Snowflake from a given ULong value.

constructor(value: String)

Creates a Snowflake from a given String value, parsing it as a ULong value.

constructor(timestamp: Instant)

Creates a Snowflake from a given timestamp.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Increment. For every Snowflake ID that is generated on a process, this number is incremented.

Link copied to clipboard

Internal ID of the process that generated this Snowflake ID.

Link copied to clipboard

A TimeMark for the point in time this Snowflake represents.

Link copied to clipboard

The point in time this Snowflake represents.

Link copied to clipboard

The raw value of this Snowflake as specified by the Discord Developer Documentation.

Link copied to clipboard

Internal ID of the worker that generated this Snowflake ID.

Functions

Link copied to clipboard
open operator override fun compareTo(other: Snowflake): Int

Compares this Snowflake to another Snowflake.

Link copied to clipboard
operator fun component1(): Instant

Returns timestamp for use in destructuring declarations.

Link copied to clipboard
operator fun component2(): UByte

Returns workerId for use in destructuring declarations.

Link copied to clipboard
operator fun component3(): UByte

Returns processId for use in destructuring declarations.

Link copied to clipboard
operator fun component4(): UShort

Returns increment for use in destructuring declarations.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String