Please describe the problem you are having in as much detail as possible:
I think this function will be helpful such as tracing backlogs of a specific server by using fetchMessages(). The code using now generates snowflake only for the current timestamp Date.now()
Include a reproducible code sample here, if possible:
discord.js/src/util/Snowflake.js:
I rewrited some parts to make the generate function more "dynamic":
static generate(time = null) {
if (INCREMENT >= 4095) INCREMENT = 0;
var timestamp = + new Date(); // Date to Timestamp conversion
if (time !== null) {
timestamp = Date.parse(time) // Test if time string is valid
if (!timestamp) return false;
}
const BINARY = `${pad((timestamp - EPOCH).toString(2), 42)}0000100000${pad((INCREMENT++).toString(2), 12)}`;
return Long.fromString(BINARY, 2).toString();
}
The code will now return a snowflake with the corresponding timestamp value.
Further details:
shouldn't you just PR that "feature" instead opening an issue :thinking:
Sorry but I am a newbie of github, I will try that way.
Most helpful comment
shouldn't you just PR that "feature" instead opening an issue :thinking: