Message

class Message(val data: MessageData, val kord: Kord, val supplier: EntitySupplier = kord.defaultSupplier) : MessageBehavior(source)

An instance of a https://discord.com/developers/docs/resources/channel#message-object.

Constructors

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

Types

Link copied to clipboard
class Interaction(val data: MessageInteractionData, val kord: Kord, val supplier: EntitySupplier = kord.defaultSupplier) : KordEntity, Strategizable

An instance of MessageInteraction

Properties

Link copied to clipboard
Link copied to clipboard

If the message is a response to an ActionInteraction, this is the id of the interaction's application

Link copied to clipboard

The files attached to this message.

Link copied to clipboard
val author: User?

The author of this message, if it was created by a User.

Link copied to clipboard

The channel behavior that this message belongs to.

Link copied to clipboard
open override val channelId: Snowflake

The id of the MessageChannel this message was send in.

Link copied to clipboard

The content of this message.

Link copied to clipboard
Link copied to clipboard

The instant when this message was last edited, if ever.

Link copied to clipboard

The embedded content of this message.

Link copied to clipboard

The flags of this message.

Link copied to clipboard
open override val id: Snowflake

The id of this message.

Link copied to clipboard

The Message.Interaction sent on this message object when it is a response to an ActionInteraction.

Link copied to clipboard

Whether the message was pinned in its channel.

Link copied to clipboard
open override val kord: Kord

The kord instance that created this object.

Link copied to clipboard

The Channels specifically mentioned in this message.

Link copied to clipboard

The ids of Channels specifically mentioned in this message.

Link copied to clipboard

The Channels specifically mentioned in this message.

Link copied to clipboard

The ids of roles mentioned in this message.

Link copied to clipboard

The roles mentioned in this message.

Link copied to clipboard

The Behaviors of users mentioned in this message.

Link copied to clipboard

The ids of users mentioned in this message.

Link copied to clipboard

The users mentioned in this message.

Link copied to clipboard

True if this message mentions @everyone.

Link copied to clipboard

reference data sent with crossposted messages and replies.

Link copied to clipboard

A generally increasing integer that represents the approximate position of the message in the thread. Can be used to estimate the relative position along with total_message_sent on the parent thread,

Link copied to clipboard

The reactions to this message.

Link copied to clipboard

The message being replied to.

Link copied to clipboard

The data of the RoleSubscription purchase or renewal that prompted this RoleSubscriptionPurchase message.

Link copied to clipboard

The stickers sent with this message.

Link copied to clipboard
open override val supplier: EntitySupplier

The supplier used to request entities.

Link copied to clipboard

The instant when this message was created.

Link copied to clipboard

Whether this message was send using \tts.

Link copied to clipboard

The type of this message.

Link copied to clipboard

The id of the Webhook that was used to send this message.

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 override fun asMessage(): Message

Returns itself.

Link copied to clipboard
open suspend override 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 operator override fun equals(other: Any?): Boolean
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
suspend fun getAuthorAsMember(): Member

Requests to get the author as a member.

Link copied to clipboard

Requests to get the author as a member.

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
suspend fun getGuild(): Guild

Requests to get the guild of this message.

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

Requests to get the guild of this message, returns null if the Guild isn't present or this message wasn't made in a guild.

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 override fun hashCode(): Int
Link copied to clipboard
suspend fun Message.live(coroutineScope: CoroutineScope = kord + SupervisorJob(kord.coroutineContext.job)): LiveMessage
suspend fun Message.live(coroutineScope: CoroutineScope = kord + SupervisorJob(kord.coroutineContext.job), block: LiveMessage.() -> Unit): LiveMessage
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 override fun toString(): String
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<*>): Message

Returns a new Message with the given strategy.