Is it feasible to grab a random message from a server?

I'd like to be able to grab a completely random message that was sent anywhere/anytime in a server. Is this feasible without having to do something stupid like crawling through the entire server history beforehand.
6 Replies
d.js toolkit
d.js toolkit6mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
duck
duck6mo ago
You could pick a random text based channel, pick a random time between <GuildChannel>.createdTimestamp and the current time, generate a snowflake for that timestamp with SnowflakeUtil.generate(), and use it for the around option when fetching messages (with limit: 1), but this wouldn't necessarily have equal chance for each message
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
duck
duck6mo ago
I mean it's an imperfect solution anyways May not necessarily be what they're looking for
Pillowfication
PillowficationOP6mo ago
works for me I can fudge some things around with that to make it closer to uniformly random

Did you find this page helpful?