K
Kord•2mo ago
Stan

Missing `DiscordChannel.message` for thread channels

Heya, whenever I create a thread in a thread-only channel (a forum), according to the docs I should receive the message that was originally used to create the thread. However this message is missing for me, it seems the thread always gets treated as a regular thread. In fact, I cannot even see the original message in the entire messages flow of the thread. I am thinking I am missing something obvious, any help would be appreciated 🙂
6 Replies
gdude
gdude•2mo ago
The original message should have the same ID as the thread itself if you only have a Channel entity, remember to .asOfOrNull<ForumThread>() or whatever the type is
Stan
StanOP•2mo ago
I see, that's useful, so I can fetch it like that. Hmm, I thought that was just a smart cast. When debugging the code, I cannot see the forum thread-specific data anywhere, so unless that code actually fetches more data from somewhere to complete the type, I don't think it will solve the issue
gdude
gdude•2mo ago
each type has different properties and functions available you don't get all the functionality on the base type
Stan
StanOP•2mo ago
/**
* A thread channel instance whose parent is a [TextChannel] or [ForumChannel].
*/
public class TextChannelThread(
override val data: ChannelData,
override val kord: Kord,
override val supplier: EntitySupplier = kord.defaultSupplier
) : ThreadChannel {
/**
* A thread channel instance whose parent is a [TextChannel] or [ForumChannel].
*/
public class TextChannelThread(
override val data: ChannelData,
override val kord: Kord,
override val supplier: EntitySupplier = kord.defaultSupplier
) : ThreadChannel {
This is the type I am using, which seems correct for forum channel threads (given the docs).
gdude
gdude•2mo ago
yep, seems like it
LustigerLurch
LustigerLurch•2mo ago
hm, i can't reproduce this, both of these get me the initial message:
val forum: ForumChannel = TODO()
val thread = forum.startPublicThread("name") {
message("some message content")
}
println(thread.message)
println(thread.messages.single())
val forum: ForumChannel = TODO()
val thread = forum.startPublicThread("name") {
message("some message content")
}
println(thread.message)
println(thread.messages.single())
Want results from more Discord servers?
Add your server