Table of Contents

Class MessageExtensions

Namespace
Discord
Assembly
Discord.Net.Core.dll

Provides extension methods for IMessage.

public static class MessageExtensions
Inheritance
MessageExtensions
Inherited Members

Methods

AddReactionsAsync(IUserMessage, IEnumerable<IEmote>, RequestOptions)

Add multiple reactions to a message.

public static Task AddReactionsAsync(this IUserMessage msg, IEnumerable<IEmote> reactions, RequestOptions options = null)

Parameters

msg IUserMessage

The message to add reactions to.

reactions IEnumerable<IEmote>

An array of reactions to add to the message.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous operation for adding a reaction to this message.

Examples

IEmote A = new Emoji("🅰");
IEmote B = new Emoji("🅱");
await msg.AddReactionsAsync(new[] { A, B });

Remarks

This method does not bulk add reactions! It will send a request for each reaction included.

See Also

GetJumpUrl(IMessage)

Gets a URL that jumps to the message.

public static string GetJumpUrl(this IMessage msg)

Parameters

msg IMessage

The message to jump to.

Returns

string

A string that contains a URL for jumping to the message in chat.

RemoveReactionsAsync(IUserMessage, IUser, IEnumerable<IEmote>, RequestOptions)

Remove multiple reactions from a message.

public static Task RemoveReactionsAsync(this IUserMessage msg, IUser user, IEnumerable<IEmote> reactions, RequestOptions options = null)

Parameters

msg IUserMessage

The message to remove reactions from.

user IUser

The user who removed the reaction.

reactions IEnumerable<IEmote>

An array of reactions to remove from the message.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous operation for removing a reaction to this message.

Examples

await msg.RemoveReactionsAsync(currentUser, new[] { A, B });

Remarks

This method does not bulk remove reactions! If you want to clear reactions from a message, RemoveAllReactionsAsync(RequestOptions)

See Also

ReplyAsync(IUserMessage, string, bool, Embed, AllowedMentions, RequestOptions, MessageComponent, ISticker[], Embed[], MessageFlags)

Sends an inline reply that references a message.

public static Task<IUserMessage> ReplyAsync(this IUserMessage msg, string text = null, bool isTTS = false, Embed embed = null, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)

Parameters

msg IUserMessage

The message that is being replied on.

text string

The message to be sent.

isTTS bool

Determines whether the message should be read aloud by Discord or not.

embed Embed

The RichEmbed to be sent.

allowedMentions AllowedMentions

Specifies if notifications are sent for mentioned users and roles in the message text. If null, all mentioned roles and users will be notified.

options RequestOptions

The options to be used when sending the request.

components MessageComponent

The message components to be included with this message. Used for interactions.

stickers ISticker[]

A collection of stickers to send with the message.

embeds Embed[]

A array of Embeds to send with this response. Max 10.

flags MessageFlags

Message flags combined as a bitfield.

Returns

Task<IUserMessage>

A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message.