Does <GuildMessageManager>.fetch({ limit: x }) return a sorted Collection of message ?

Hi When I call the method fetch from GuildMessageManager, I'd like to know if we can be sure that the collection returned is sorted and that the .last() method returns the real last message sent. In other words, does this code will always return the last message sent:
const channel: TextChannel = ....;
const messages = await channel.messages.fetch({ limit: 2 });
const lastMessage = messages.last(); // Are we sure that it's the real last message sent ??
const channel: TextChannel = ....;
const messages = await channel.messages.fetch({ limit: 2 });
const lastMessage = messages.last(); // Are we sure that it's the real last message sent ??
Versions - DiscordJs <:white_right_arrow:1182354037346148482> 14.14.1 - NodeJs <:white_right_arrow:1182354037346148482> 18.17.1
2 Replies
d.js toolkit
d.js toolkit12mo 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! - Marked as resolved by staff
Apokalypt
ApokalyptOP12mo ago
Oh, thanks. That make sense 👍
Want results from more Discord servers?
Add your server