LiveBot
LiveBot copied to clipboard
Ability to see past messages?
I'm not sure if this is a suggestion or not, more of a question, so apologies if this isn't the correct place to put this. Will there be an ability to see past messages? Scrolling up gives me a "Sorry! No messages beyond this point can be displayed" notification, so I was wondering if this would ever be touched upon further.
I believe as stated here, there seems to be a limit to the cache that the bot can fetch which is currently set to 100. Therefore, we can have a look at Partial Structures to bypass the limit. Not so sure if I understood correctly.
Hello @tekentwo! We're thinking if we should add this or not because of the recent events, otherwise it was planned to be added before this but we are trying to add other stuff first before we add this, the main developer @SebOuellette said he might add it in the next couple of days but that's not certain
@J370 to address the partial structures, they're not needed in this situation since it's possible to fetch more than a 100 messages. Well, not at once but doing it in chunks of 100 is possible, here's the links from the official documentation from discord.js
So, knowing that there's a message parameter that accepts a Snowflake and ChannelLogsQueryOptions
If we look at ChannelLogsQueryOptions we can see it has a few parameters limit, before, after and around, the first one is a number and the rest are a Snowflake
All we need now is to combine it all so using channel.messages.fetch({before: id, limit:100}) will give us every message before the certain id, assuming we already fetched once without the before we'll have the messages cached and we just have to get the last one (Goes from the latest message to the oldest, LiveBot reverses them so they're listed from oldest to latest)
TLDR cause I went overboard: It's possible to fetch more messages if you know the id of the oldest one and we don't know yet if we should add it or not
This could be improved by using some kind of a system that fetches messages around the one in focus at the current moment and pops ones that are out of sight out of the cache (like Minecraft chunk rendering)