MessageBehavior

The behavior of a Discord Message.

Inheritors

Properties

Link copied to clipboard

The channel behavior that this message belongs to.

Link copied to clipboard
abstract val channelId: Snowflake

The channel id this message belongs to.

Link copied to clipboard
abstract val id: Snowflake

The unique identifier of this entity.

Link copied to clipboard
abstract val kord: Kord

The kord instance that created this object.

Link copied to clipboard
abstract val supplier: EntitySupplier

The supplier used to request entities.

Functions

Link copied to clipboard
open suspend fun addReaction(emoji: GuildEmoji)
open suspend fun addReaction(emoji: ReactionEmoji)

Requests to add an emoji to this message.

Link copied to clipboard
open suspend fun asMessage(): Message

Requests to get this behavior as a Message.

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

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

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

Compares entities on id.

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

Requests to delete this message.

open suspend fun delete(webhookId: Snowflake, token: String, threadId: Snowflake? = null)

Requests to delete this message if it was previously sent from a Webhook with the given webhookId using the token for authentication.

Link copied to clipboard
open suspend fun deleteAllReactions()

Requests to delete all reactions from this message.

Link copied to clipboard
open suspend fun deleteOwnReaction(emoji: ReactionEmoji)

Requests to delete an emoji from this message made by this bot.

Link copied to clipboard
open suspend fun deleteReaction(emoji: ReactionEmoji)

Requests to delete all emoji reactions from this message.

open suspend fun deleteReaction(userId: Snowflake, emoji: ReactionEmoji)

Requests to delete an emoji from this message made by a userId.

Link copied to clipboard
inline suspend fun MessageBehavior.edit(builder: UserMessageModifyBuilder.() -> Unit): Message

Requests to edit this message.

inline suspend fun MessageBehavior.edit(webhookId: Snowflake, token: String, threadId: Snowflake? = null, builder: WebhookMessageModifyBuilder.() -> Unit): Message

Requests to edit this message if it was previously sent from a Webhook with the given webhookId using the token for authentication.

Link copied to clipboard
open suspend fun fetchMessage(): Message

Retrieve the Message associated with this behaviour from the provided EntitySupplier

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

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

Link copied to clipboard
open suspend fun getChannel(): MessageChannel

Requests to get the channel this message was send in.

Link copied to clipboard
open suspend fun getChannelOrNull(): MessageChannel?
Link copied to clipboard
open fun getReactors(emoji: ReactionEmoji): Flow<User>

Requests to get all users that have reacted to this message.

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

Requests to pin this message.

Link copied to clipboard
open suspend fun publish(): Message

Requests to publish this message to following channels, this function assumes the message was created in an announcement channel.

Link copied to clipboard
inline suspend fun MessageBehavior.reply(builder: UserMessageCreateBuilder.() -> Unit): Message

Request to reply to this message, setting messageReference to this message's id.

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

Requests to unpin this message.

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

Returns a new MessageBehavior with the given strategy.