mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 01:40:08 +00:00
14 lines
376 B
TypeScript
14 lines
376 B
TypeScript
import type { BigString } from '@discordeno/types'
|
|
|
|
export function snowflakeToBigint(snowflake: BigString): bigint {
|
|
return BigInt(snowflake)
|
|
}
|
|
|
|
export function bigintToSnowflake(snowflake: BigString): string {
|
|
return snowflake.toString()
|
|
}
|
|
|
|
export function snowflakeToTimestamp(snowflake: BigString): number {
|
|
return Number(BigInt(snowflake) >> 22n) + 1420070400000
|
|
}
|