Allow converting a Timestamp back into a snowflake ID #3423
inklesspen
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
According to the API docs, for timestamps within the legal range, you can convert them into a snowflake ID as
(timestamp_ms - DISCORD_EPOCH) << 22
. This is useful for pagination; you can search for messages before or after a specific time.In my project I've currently done a very half-assed version of this:
Additionally, you can pass 0 as the snowflake for "the beginning of time"; however this would seem to pose a larger problem due to the snowflake ID types relying on NonZeroU64.
Beta Was this translation helpful? Give feedback.
All reactions