Skip to content

Fetch message on specific channel #327

Answered by NekoCyan
gunawans67 asked this question in Q&A
Discussion options

You must be logged in to vote

Try this one.

let channel = client.channels.cache.get("channel_id");
const fetched = await channel.messages.fetch({ limit: 2 });
let lastMessage = fetched.toJSON()[0];

For more Informations: TextChannel.messages.

Or you can Use TextChannel.lastMessage to get Last Message without fetch (If you had cached it before or idk if it's needed to be catch XD).

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@gunawans67
Comment options

@NekoCyan
Comment options

@aiko-chan-ai
Comment options

Answer selected by gunawans67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants