Snowflake

Discord utilizes Twitter's snowflake format for uniquely identifiable descriptors (IDs). These IDs are guaranteed to be unique across all of Discord, except in some unique scenarios in which child objects share their parent's ID.

External API Reference

See also

Constructors

Link copied to clipboard
fun Snowflake(id: String)

Parses snowflake encoded as string

Link copied to clipboard
fun Snowflake(id: ULong)

Types

Link copied to clipboard
object Companion

Functions

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

Encodes snowflake as string

Properties

Link copied to clipboard
val id: ULong

Packed 64-bit snowflake representation

Extensions

Link copied to clipboard
operator fun Snowflake.component1(): ULong
Link copied to clipboard
operator fun Snowflake.component2(): Byte
Link copied to clipboard
operator fun Snowflake.component3(): Byte
Link copied to clipboard
operator fun Snowflake.component4(): Short
Link copied to clipboard

Number of milliseconds since discord epoch (first second of 2015)

Link copied to clipboard

For every ID that is generated on that process this value increments

Link copied to clipboard

Internal process ID who generates that snowflake

Link copied to clipboard
Link copied to clipboard
val Snowflake.time: Instant

Time of generation given snowflake

Link copied to clipboard

Number of milliseconds since unix epoch (first second of 1970)

Link copied to clipboard

Internal worker ID who generates that snowflake