Browse Source

[ifcbrk] feature: id overload for RemoveReactionAsync (#1310)

* Added id overload for RemoveReactionAsync

* Fixed the docs strings
tags/2.2.0
Casino Boyale Christopher F 5 years ago
parent
commit
c88b1dada7
4 changed files with 27 additions and 4 deletions
  1. +17
    -0
      src/Discord.Net.Core/Entities/Messages/IUserMessage.cs
  2. +2
    -2
      src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
  3. +4
    -1
      src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs
  4. +4
    -1
      src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs

+ 17
- 0
src/Discord.Net.Core/Entities/Messages/IUserMessage.cs View File

@@ -96,6 +96,23 @@ namespace Discord
/// <seealso cref="IEmote"/> /// <seealso cref="IEmote"/>
Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null); Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null);
/// <summary> /// <summary>
/// Removes a reaction from message.
/// </summary>
/// <example>
/// The following example removes the reaction, <c>💕</c>, added by the user with ID 84291986575613952 from the message.
/// <code language="cs">
/// await msg.RemoveReactionAsync(new Emoji("\U0001f495"), 84291986575613952);
/// </code>
/// </example>
/// <param name="emote">The emoji used to react to this message.</param>
/// <param name="userId">The ID of the user that added the emoji.</param>
/// <param name="options">The options to be used when sending the request.</param>
/// <returns>
/// A task that represents the asynchronous operation for removing a reaction to this message.
/// </returns>
/// <seealso cref="IEmote"/>
Task RemoveReactionAsync(IEmote emote, ulong userId, RequestOptions options = null);
/// <summary>
/// Removes all reactions from this message. /// Removes all reactions from this message.
/// </summary> /// </summary>
/// <param name="options">The options to be used when sending the request.</param> /// <param name="options">The options to be used when sending the request.</param>


+ 2
- 2
src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs View File

@@ -50,9 +50,9 @@ namespace Discord.Rest
await client.ApiClient.AddReactionAsync(msg.Channel.Id, msg.Id, emote is Emote e ? $"{e.Name}:{e.Id}" : emote.Name, options).ConfigureAwait(false); await client.ApiClient.AddReactionAsync(msg.Channel.Id, msg.Id, emote is Emote e ? $"{e.Name}:{e.Id}" : emote.Name, options).ConfigureAwait(false);
} }


public static async Task RemoveReactionAsync(IMessage msg, IUser user, IEmote emote, BaseDiscordClient client, RequestOptions options)
public static async Task RemoveReactionAsync(IMessage msg, ulong userId, IEmote emote, BaseDiscordClient client, RequestOptions options)
{ {
await client.ApiClient.RemoveReactionAsync(msg.Channel.Id, msg.Id, user.Id, emote is Emote e ? $"{e.Name}:{e.Id}" : emote.Name, options).ConfigureAwait(false);
await client.ApiClient.RemoveReactionAsync(msg.Channel.Id, msg.Id, userId, emote is Emote e ? $"{e.Name}:{e.Id}" : emote.Name, options).ConfigureAwait(false);
} }


public static async Task RemoveAllReactionsAsync(IMessage msg, BaseDiscordClient client, RequestOptions options) public static async Task RemoveAllReactionsAsync(IMessage msg, BaseDiscordClient client, RequestOptions options)


+ 4
- 1
src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs View File

@@ -155,7 +155,10 @@ namespace Discord.Rest
=> MessageHelper.AddReactionAsync(this, emote, Discord, options); => MessageHelper.AddReactionAsync(this, emote, Discord, options);
/// <inheritdoc /> /// <inheritdoc />
public Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null) public Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null)
=> MessageHelper.RemoveReactionAsync(this, user, emote, Discord, options);
=> MessageHelper.RemoveReactionAsync(this, user.Id, emote, Discord, options);
/// <inheritdoc />
public Task RemoveReactionAsync(IEmote emote, ulong userId, RequestOptions options = null)
=> MessageHelper.RemoveReactionAsync(this, userId, emote, Discord, options);
/// <inheritdoc /> /// <inheritdoc />
public Task RemoveAllReactionsAsync(RequestOptions options = null) public Task RemoveAllReactionsAsync(RequestOptions options = null)
=> MessageHelper.RemoveAllReactionsAsync(this, Discord, options); => MessageHelper.RemoveAllReactionsAsync(this, Discord, options);


+ 4
- 1
src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs View File

@@ -151,7 +151,10 @@ namespace Discord.WebSocket
=> MessageHelper.AddReactionAsync(this, emote, Discord, options); => MessageHelper.AddReactionAsync(this, emote, Discord, options);
/// <inheritdoc /> /// <inheritdoc />
public Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null) public Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null)
=> MessageHelper.RemoveReactionAsync(this, user, emote, Discord, options);
=> MessageHelper.RemoveReactionAsync(this, user.Id, emote, Discord, options);
/// <inheritdoc />
public Task RemoveReactionAsync(IEmote emote, ulong userId, RequestOptions options = null)
=> MessageHelper.RemoveReactionAsync(this, userId, emote, Discord, options);
/// <inheritdoc /> /// <inheritdoc />
public Task RemoveAllReactionsAsync(RequestOptions options = null) public Task RemoveAllReactionsAsync(RequestOptions options = null)
=> MessageHelper.RemoveAllReactionsAsync(this, Discord, options); => MessageHelper.RemoveAllReactionsAsync(this, Discord, options);


Loading…
Cancel
Save