SnowflakeUtil
classe · Source
A container for useful snowflake-related methods.
Properties
EPOCH
EPOCH: number
Discord's epoch value (2015-01-01T00:00:00.000Z). Source
Methods
generate
generate(timestamp?: number | Date): Snowflake
Generates a Discord snowflake. This hardcodes the worker's id as 1 and the process's id as 0. Parameters
| Name | Type | Description |
|---|---|---|
timestamp? | number | Date | Timestamp or date of the snowflake to generate Default: Date.now(). |
Returns: Snowflake — The generated snowflake Source
deconstruct
deconstruct(snowflake: Snowflake): DeconstructedSnowflake
Deconstructs a Discord snowflake. Parameters
| Name | Type | Description |
|---|---|---|
snowflake | Snowflake | Snowflake to deconstruct |
Returns: DeconstructedSnowflakeSource
timestampFrom
timestampFrom(snowflake: Snowflake): number
Retrieves the timestamp field's value from a Discord snowflake. Parameters
| Name | Type | Description |
|---|---|---|
snowflake | Snowflake | Snowflake to get the timestamp value from |
Returns: numberSource