discljord.snowflakes
discord-epoch
The Discord epoch - the number of milliseconds that had passed since January 1, 1970, on January 1, 2015.
increment
(increment snowflake)
Returns the increment of this id, i.e. the number of ids that had been generated before on its process.
Takes either a string or a number representing the snowflake.
internal-process-id
(internal-process-id snowflake)
Returns the internal id of the process this id was generated on.
Takes either a string or a number representing the snowflake.
internal-worker-id
(internal-worker-id snowflake)
Returns the internal id of the worker that generated this id.
Takes either a string or a number representing the snowflake.
parse-snowflake
(parse-snowflake snowflake)
Extracts all information from the given id and returns it as a map.
The map has the following keys:
`:id` - The input snowflake as a number
`:timestamp` - See [[timestamp]]
`:internal-worker-id` - See [[internal-worker-id]]
`:internal-process-id` - See [[internal-process-id]]
`:increment` - See [[increment]]
timestamp
(timestamp snowflake)
Returns the UNIX timestamp (ms) for when this id was generated.
Takes either a string or a number representing the snowflake.
timestamp->snowflake
(timestamp->snowflake timestamp)
Takes a UNIX milliseconds timestamp (like from `(System/currentTimeMillis)`) and returns it as a Discord snowflake id.
This can be used for paginated endpoints where ids are used to represent bounds like
'before' and 'after' to get results before, after or between timestamps.