diff --git a/src/Discord.Net.Core/Extensions/MessageExtensions.cs b/src/Discord.Net.Core/Extensions/MessageExtensions.cs index 90185cb6d..90ebea92f 100644 --- a/src/Discord.Net.Core/Extensions/MessageExtensions.cs +++ b/src/Discord.Net.Core/Extensions/MessageExtensions.cs @@ -1,3 +1,5 @@ +using System.Threading.Tasks; + namespace Discord { /// @@ -17,5 +19,57 @@ namespace Discord var channel = msg.Channel; return $"https://discordapp.com/channels/{(channel is IDMChannel ? "@me" : $"{(channel as ITextChannel).GuildId}")}/{channel.Id}/{msg.Id}"; } + + /// + /// Add multiple reactions to a message. + /// + /// + /// This method does not bulk add reactions! It will send a request for each reaction inculded. + /// + /// + /// + /// IEmote A = new Emoji("🅰"); + /// IEmote B = new Emoji("🅱"); + /// await msg.AddReactionsAsync(new[] { A, B }); + /// + /// + /// The message to add reactions to. + /// An array of reactions to add to the message + /// The options to be used when sending the request. + /// + /// A task that represents the asynchronous operation for adding a reaction to this message. + /// + /// + /// + public static async Task AddReactionsAsync(this IUserMessage msg, IEmote[] reactions, RequestOptions options = null) + { + foreach (var rxn in reactions) + await msg.AddReactionAsync(rxn, options).ConfigureAwait(false); + } + /// + /// Remove multiple reactions from a message. + /// + /// + /// This method does not bulk remove reactions! If you want to clear reactions from a message, + /// + /// + /// + /// + /// await msg.RemoveReactionsAsync(currentUser, new[] { A, B }); + /// + /// + /// The message to remove reactions from. + /// An array of reactions to remove from the message + /// The options to be used when sending the request. + /// + /// A task that represents the asynchronous operation for removing a reaction to this message. + /// + /// + /// + public static async Task RemoveReactionsAsync(this IUserMessage msg, IUser user, IEmote[] reactions, RequestOptions options = null) + { + foreach (var rxn in reactions) + await msg.RemoveReactionAsync(rxn, user, options).ConfigureAwait(false); + } } }