Extract the thread id from a ThreadCreated message
How do i extract the thread id from a message of type MessageType.ThreadCreated?
18 Replies
You'd use the
channel
or channelId
propertymessage.channel
returns the channel message has been sent to and not the thread channelOh, I see what you mean
Maybe it's in the
data
property somewhere?no, nothing new, it doesn't seem to be in
mentionedChannels
and content only returns the thread nameHmm, it has to be in there somewhere, but I can't go look myself right now
@LustigerLurch shouldn't MessageData have a thread field?
Discord Developer Portal
Discord Developer Portal — API Docs for Bots and Developers
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Could you set the log level to TRACE and check whether the
thread
field is present for that message
After looking into this you can't, you can only get the thread from the message which created the thread itselfI printed message.data and realized that the message id is basically the thread id
That's interesting
you're right, at least its id for caching
@rebok https://discord.com/developers/docs/topics/threads#new-message-types it seems to be
message.messageReference?.channel?.id
Discord Developer Portal
Discord Developer Portal — API Docs for Bots and Developers
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
this will be available in my PR
@LustigerLurch could you guess why it 401'd
maybe it is time for message subtypes that account for these strange cases @gdude ...
I mean this makes sense
the thread created message is a reply to the creating message
what did 401? receiving the message can't be it
But yeah subtypes would probbably improve discoverability
sonatype
oh wait maybe it's the new account center
yeah subtypes might be good, that was part of bart's plan a long time ago anyway