TextChannel

An instance of a Discord Text Channel associated to a guild.

Constructors

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

Properties

Link copied to clipboard

Returns all active public and private threads in the channel. Threads are ordered by their id, in descending order.

Link copied to clipboard

The category behavior this channel belongs to, if any.

Link copied to clipboard

The id of the category this channel belongs to, if any.

Link copied to clipboard
open override val data: ChannelData
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

Requests to get the invites of this channel.

Link copied to clipboard

Whether the channel is nsfw.

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 mention: String

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

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

The permission overwrites for this channel.

Link copied to clipboard

Requests to get the pinned messages in this channel.

Link copied to clipboard
open val rawPosition: Int

The raw position of this channel in the guild as displayed by Discord.

Link copied to clipboard
open override val supplier: EntitySupplier

The supplier used to request entities.

Link copied to clipboard
open val topic: String?

The channel topic, if present.

Link copied to clipboard
open val type: ChannelType

The type of this channel.

Link copied to clipboard

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

Link copied to clipboard
open val webhooks: Flow<Webhook>

Requests to get all webhooks for this channel.

Functions

Link copied to clipboard
open suspend fun addOverwrite(overwrite: PermissionOverwrite, reason: String? = null)

Requests to add or replace a PermissionOverwrite to this entity.

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

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(): TextChannel

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

Request to create an InviteWithMetadata for this channel.

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
inline suspend fun CategorizableChannelBehavior.createWebhook(name: String, builder: WebhookCreateBuilder.() -> Unit = {}): Webhook

Requests to create a new webhook 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

Requests to edit this channel.

Link copied to clipboard

Requests to add or replace a PermissionOverwrite for the memberId.

Link copied to clipboard

Requests to add or replace a PermissionOverwrite for the roleId.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
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 getEffectivePermissions(memberId: Snowflake): Permissions

Calculates the effective permissions of the memberId in this channel, applying the overwrite for the member and their roles on top of the base permissions.

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 override fun getJoinedPrivateArchivedThreads(before: Snowflake?, limit: Int?): Flow<TextChannelThread>

Returns archived threads in the channel that are private, and the user has joined. Threads are ordered by their ThreadChannel.id in descending order. Requires the Read Message History Permission.

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

Gets the permission overwrite for the memberId in this channel, if present.

Link copied to clipboard

Gets the permission overwrite for the roleId in this channel, if present.

Link copied to clipboard
open suspend fun getPosition(): Int

Requests to get the position of this channel in the guild, as displayed in Discord.

Link copied to clipboard
open override fun getPrivateArchivedThreads(before: Instant?, limit: Int?): Flow<TextChannelThread>

Returns archived threads in the channel that are private. Threads are ordered by ThreadChannel.archiveTimestamp in descending order. Requires the Read Message History Permission and Manage Threads Permission

Link copied to clipboard
open override fun getPublicArchivedThreads(before: Instant?, limit: Int?): Flow<TextChannelThread>

Returns archived threads in the channel that are public. Threads are ordered by ThreadChannel.archiveTimestamp in descending order. Requires the Read Message History Permission

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun Channel.live(coroutineScope: CoroutineScope = kord + SupervisorJob(kord.coroutineContext.job)): LiveChannel
fun TopGuildChannel.live(coroutineScope: CoroutineScope = kord + SupervisorJob(kord.coroutineContext.job)): LiveGuildChannel
fun TopGuildMessageChannel.live(coroutineScope: CoroutineScope = kord + SupervisorJob(kord.coroutineContext.job)): LiveGuildMessageChannel
inline fun Channel.live(coroutineScope: CoroutineScope = kord + SupervisorJob(kord.coroutineContext.job), block: LiveChannel.() -> Unit): LiveChannel
inline fun TopGuildChannel.live(coroutineScope: CoroutineScope = kord + SupervisorJob(kord.coroutineContext.job), block: LiveGuildChannel.() -> Unit): LiveGuildChannel
inline fun TopGuildMessageChannel.live(coroutineScope: CoroutineScope = kord + SupervisorJob(kord.coroutineContext.job), block: LiveGuildMessageChannel.() -> Unit): LiveGuildMessageChannel
Link copied to clipboard
open suspend fun startPrivateThread(name: String, builder: StartThreadBuilder.() -> Unit = {}): TextChannelThread
Link copied to clipboard
open suspend fun startPublicThread(name: String, builder: StartThreadBuilder.() -> Unit = {}): TextChannelThread
Link copied to clipboard
open suspend fun startPublicThreadWithMessage(messageId: Snowflake, name: String, builder: StartThreadWithMessageBuilder.() -> Unit = {}): TextChannelThread
Link copied to clipboard
open override fun toString(): String
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<*>): TextChannel

returns a new TextChannel with the given strategy.