TextChannelThread

class TextChannelThread(val data: ChannelData, val kord: Kord, val supplier: EntitySupplier = kord.defaultSupplier) : ThreadChannel(source)

A thread channel instance whose parent is a TextChannel or ForumChannel.

Constructors

Link copied to clipboard
constructor(data: ChannelData, kord: Kord, supplier: EntitySupplier = kord.defaultSupplier)

Properties

Link copied to clipboard

Only available when creating a thread in a ForumChannel or MediaChannel.

Link copied to clipboard

The timestamp when the thread's archive status was last changed.

Link copied to clipboard

The time in which the thread will be auto archived after inactivity.

Link copied to clipboard

The timestamp when the thread was created.

Link copied to clipboard
open override val data: ChannelData
Link copied to clipboard

The default duration setup pre-selected for this thread.

Link copied to clipboard
open val flags: ChannelFlags?

The flags of this channel, if present.

Link copied to clipboard

The guild behavior this channel is associated to.

Link copied to clipboard
open override val guildId: Snowflake

The id of the guild this channel is associated to.

Link copied to clipboard
open override val id: Snowflake

The unique identifier of this entity.

Link copied to clipboard

Whether the channel is archived. Users cannot edit messages, add reactions, use slash commands, or join archived threads. The only operation that should happen within an archived thread is messages being deleted. Sending a message will automatically unarchive the thread, unless the thread has been locked by a moderator.

Link copied to clipboard

Whether non-moderators can add other non-moderators to a thread.

Link copied to clipboard
open val isLocked: Boolean

Threads that have isLocked set to true can only be unarchived by a user with the Manage Threads permission.

Link copied to clipboard
open val isNsfw: Boolean

Whether the channel is nsfw. This is inherited from the parent channel.

Link copied to clipboard

Whether this thread is private.

Link copied to clipboard
open override val kord: Kord

The kord instance that created this object.

Link copied to clipboard

The behavior of the last message sent to this channel, if present.

Link copied to clipboard

The id of the last message sent to this channel, if present.

Link copied to clipboard

The timestamp of the last pin

Link copied to clipboard
open val member: ThreadMember?

The member of the current user in the thread.

Link copied to clipboard
open val memberCount: Int?

An approximate count of users in this thread, stops counting at 50.

Link copied to clipboard

Requests to get all members of the current thread.

Link copied to clipboard
open val mention: String

This channel formatted as a mention as used by the Discord API.

Link copied to clipboard
open val message: Message?

Only available when creating a thread in a ForumChannel or MediaChannel.

Link copied to clipboard
open val messageCount: Int?

Number of messages (not including the initial message or deleted messages) in this thread.

Link copied to clipboard
open val messages: Flow<Message>

Requests to get all messages in this channel.

Link copied to clipboard
open val name: String

The name of this channel.

Link copied to clipboard
Link copied to clipboard
open val ownerId: Snowflake

The id of the user who created the thread.

Link copied to clipboard
Link copied to clipboard
open override val parentId: Snowflake
Link copied to clipboard

Requests to get the pinned messages in this channel.

Link copied to clipboard

The amount of time a user has to wait before sending another message.

Link copied to clipboard
open override val supplier: EntitySupplier

The supplier used to request entities.

Link copied to clipboard

Number of messages ever sent in this thread, it's similar to messageCount on message creation, but will not decrement the number when a message is deleted.

Link copied to clipboard
open val type: ChannelType

The type of this channel.

Functions

Link copied to clipboard
open suspend fun addUser(userId: Snowflake)

Adds the user identified by id from the current thread. Requires the thread is not locked. or current bot has Manage Threads permission

Link copied to clipboard
open suspend override fun asChannel(): TextChannelThread

Requests to get this behavior as a Channel .

Link copied to clipboard
inline suspend fun <T : Channel> ChannelBehavior.asChannelOf(): T

Requests to get the Channel represented by this ChannelBehavior.

Link copied to clipboard
inline suspend fun <T : Channel> ChannelBehavior.asChannelOfOrNull(): T?

Requests to get the Channel represented by this ChannelBehavior, returns null if the Channel isn't present.

Link copied to clipboard
open suspend override fun asChannelOrNull(): TextChannelThread

Requests to get this behavior as a Channel, returns null if the channel isn't present.

Link copied to clipboard
open suspend fun bulkDelete(messages: Iterable<Snowflake>, deleteOlderMessages: Boolean = true, reason: String? = null)

Requests to bulk delete the messages.

Link copied to clipboard
open operator override fun compareTo(other: Entity): Int

Compares entities on id.

Link copied to clipboard
inline suspend fun MessageChannelBehavior.createEmbed(block: EmbedBuilder.() -> Unit): Message

Requests to create a message with only an embed.

Link copied to clipboard
open suspend fun createMessage(content: String): Message

Requests to create a message with only a MessageCreateBuilder.content.

Link copied to clipboard

Requests to create a message configured by the builder.

Link copied to clipboard
open suspend fun delete(reason: String? = null)

Requests to delete a channel (or close it if this is a dm channel).

Link copied to clipboard
open suspend fun deleteMessage(id: Snowflake, reason: String? = null)

Requests to delete a message in this channel.

Link copied to clipboard
Link copied to clipboard
open suspend fun fetchChannel(): Channel

Retrieve the Channel associated with this behaviour from the provided EntitySupplier

Link copied to clipboard
open suspend fun fetchChannelOrNull(): Channel?

Retrieve the Channel associated with this behaviour from the provided EntitySupplier returns null if the Channel isn't present.

Link copied to clipboard
open suspend fun getGuild(): Guild

Requests to get this channel's Guild.

Link copied to clipboard
open suspend fun getGuildOrNull(): Guild?

Requests to get this channel's Guild, returns null if the guild isn't present.

Link copied to clipboard
open suspend fun getLastMessage(): Message?

Requests to get the last message sent to this channel, return null if no lastMessageId is present or if the message itself isn't present.

Link copied to clipboard
open suspend fun getMessage(messageId: Snowflake): Message

Requests to get a message with the given messageId.

Link copied to clipboard
open suspend fun getMessageOrNull(messageId: Snowflake): Message?

Requests to get a message with the given messageId, returns null if the message isn't present or is not part of this channel.

Link copied to clipboard
open fun getMessagesAfter(messageId: Snowflake, limit: Int? = null): Flow<Message>

Requests to get all messages in this channel that were created after messageId.

Link copied to clipboard
open fun getMessagesAround(messageId: Snowflake, limit: Int = 100): Flow<Message>

Requests to get Messages around (both older and newer) the messageId.

Link copied to clipboard
open fun getMessagesBefore(messageId: Snowflake, limit: Int? = null): Flow<Message>

Requests to get all messages in this channel that were created before messageId.

Link copied to clipboard
open suspend fun getParent(): ThreadParentChannel

Requests to get this channel's ThreadParentChannel.

Link copied to clipboard

Requests to get this channel's ThreadParentChannel, returns null if the thread parent isn't present.

Link copied to clipboard
open suspend fun join()

Join the the current thread. Requires the thread is not locked. or current bot has Manage Threads permission

Link copied to clipboard
open suspend fun leave()

Leaves the current thread if the bot has already joined. Requires the thread is not locked. or current bot has Manage Threads permission

Link copied to clipboard
fun Channel.live(coroutineScope: CoroutineScope = kord + SupervisorJob(kord.coroutineContext.job)): LiveChannel
inline fun Channel.live(coroutineScope: CoroutineScope = kord + SupervisorJob(kord.coroutineContext.job), block: LiveChannel.() -> Unit): LiveChannel
Link copied to clipboard
open suspend fun removeUser(userId: Snowflake)

Removes the user identified by id from the current thread. Requires the thread is not locked. or current bot has Manage Threads permission

Link copied to clipboard
open suspend fun type()

Requests to trigger the typing indicator for the bot in this channel. The typing status will persist for 10 seconds or until the bot creates a message in the channel.

Link copied to clipboard
open suspend fun typeUntil(mark: TimeMark)

Requests to trigger the typing indicator for the bot in this channel. The typing status will persist until the mark is reached.

open suspend fun typeUntil(instant: Instant)

Requests to trigger the typing indicator for the bot in this channel. The typing status will persist until the instant is reached.

Link copied to clipboard
open override fun withStrategy(strategy: EntitySupplyStrategy<*>): TextChannelThread

Returns a new GuildMessageChannel with the given strategy.