• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: How to get the content of a pinned message discord.js

Resolved: How to get the content of a pinned message discord.js

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I am making a Discord bot in discord.js and I want to get the content of a pinned message.
I know I can use interaction.channel.messages.fetchPinned().then(pinnedMessages => /* do stuf */ ); to fetch the messages. But if you try to print out the value of pinnedMessages.content it will return undefined.
The type of pinnedMessages is an object, but I do not know how I can get the contents of it.
So, how do I do this?

Answer:

fetchPinned returns a collection of messages. There are a couple of methods you can use, depending on your needs.
To get the content of the first pinned message, you can use:
To get a pinned message by its ID:
If you want to log all pinned messages’ content:

If you have better answer, please add a comment about this, thank you!

discord.js javascript node.js
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How to give rank on datetime column group by another column with userid in it

24/03/2023

Resolved: Passing 2 functions in onChange in react

24/03/2023

Resolved: Why doesn’t stringstream consume output during hex formatting?

24/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.