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
msgIUserMessageThe message to add reactions to.
reactionsIEnumerable<IEmote>An array of reactions to add to the message.
optionsRequestOptionsThe 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
msgIMessageThe 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
msgIUserMessageThe message to remove reactions from.
userIUserThe user who removed the reaction.
reactionsIEnumerable<IEmote>An array of reactions to remove from the message.
optionsRequestOptionsThe 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
msgIUserMessageThe message that is being replied on.
textstringThe message to be sent.
isTTSboolDetermines whether the message should be read aloud by Discord or not.
embedEmbedallowedMentionsAllowedMentionsSpecifies if notifications are sent for mentioned users and roles in the message
text. If null, all mentioned roles and users will be notified.optionsRequestOptionsThe options to be used when sending the request.
componentsMessageComponentThe message components to be included with this message. Used for interactions.
stickersISticker[]A collection of stickers to send with the message.
embedsEmbed[]A array of Embeds to send with this response. Max 10.
flagsMessageFlagsMessage 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.