Class MessageExtensions
Provides extension methods for IMessage.
Namespace: Discord
Assembly: Discord.Net.Core.dll
Syntax
public static class MessageExtensions : object
Methods
| Improve this Doc View SourceAddReactionsAsync(IUserMessage, IEnumerable<IEmote>, RequestOptions)
Add multiple reactions to a message.
Declaration
public static async Task AddReactionsAsync(this IUserMessage msg, IEnumerable<IEmote> reactions, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IUserMessage | msg | The message to add reactions to. |
IEnumerable<IEmote> | reactions | An array of reactions to add to the message. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous operation for adding a reaction to this message. |
Remarks
This method does not bulk add reactions! It will send a request for each reaction included.
Examples
IEmote A = new Emoji("🅰");
IEmote B = new Emoji("🅱");
await msg.AddReactionsAsync(new[] { A, B });
See Also
| Improve this Doc View SourceGetJumpUrl(IMessage)
Gets a URL that jumps to the message.
Declaration
public static string GetJumpUrl(this IMessage msg)
Parameters
Type | Name | Description |
---|---|---|
IMessage | msg | The message to jump to. |
Returns
Type | Description |
---|---|
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.
Declaration
public static async Task RemoveReactionsAsync(this IUserMessage msg, IUser user, IEnumerable<IEmote> reactions, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IUserMessage | msg | The message to remove reactions from. |
IUser | user | The user who removed the reaction. |
IEnumerable<IEmote> | reactions | An array of reactions to remove from the message. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous operation for removing a reaction to this message. |
Remarks
This method does not bulk remove reactions! If you want to clear reactions from a message, RemoveAllReactionsAsync(RequestOptions)
Examples
await msg.RemoveReactionsAsync(currentUser, new[] { A, B });
See Also
| Improve this Doc View SourceReplyAsync(IUserMessage, String, Boolean, Embed, AllowedMentions, RequestOptions, MessageComponent, ISticker[], Embed[], MessageFlags)
Sends an inline reply that references a message.
Declaration
public static async 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 = default(MessageFlags))
Parameters
Type | Name | Description |
---|---|---|
IUserMessage | msg | The message that is being replied on. |
String | text | The message to be sent. |
Boolean | isTTS | Determines whether the message should be read aloud by Discord or not. |
Embed | embed | |
AllowedMentions | allowedMentions | Specifies if notifications are sent for mentioned users and roles in the message |
RequestOptions | options | The options to be used when sending the request. |
MessageComponent | components | The message components to be included with this message. Used for interactions. |
ISticker[] | stickers | A collection of stickers to send with the message. |
Embed[] | embeds | A array of Embeds to send with this response. Max 10. |
MessageFlags | flags | Message flags combined as a bitfield. |
Returns
Type | Description |
---|---|
Task<IUserMessage> | A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. |