Browse Source

Refer to MessageHelper instead of duplicating call

pull/996/head
Hsu Still 8 years ago
parent
commit
d0230f247d
2 changed files with 9 additions and 9 deletions
  1. +4
    -6
      src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
  2. +5
    -3
      src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs

+ 4
- 6
src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs View File

@@ -184,12 +184,10 @@ namespace Discord.Rest
var model = await client.ApiClient.UploadFileAsync(channel.Id, args, options).ConfigureAwait(false); var model = await client.ApiClient.UploadFileAsync(channel.Id, args, options).ConfigureAwait(false);
return RestUserMessage.Create(client, channel, client.CurrentUser, model); return RestUserMessage.Create(client, channel, client.CurrentUser, model);
} }
public static async Task DeleteMessageAsync(IMessageChannel channel, BaseDiscordClient client,
ulong messageId, RequestOptions options)
{
await client.ApiClient.DeleteMessageAsync(channel.Id, messageId, options).ConfigureAwait(false);
}

public static Task DeleteMessageAsync(IMessageChannel channel, ulong messageId, BaseDiscordClient client,
RequestOptions options)
=> MessageHelper.DeleteAsync(channel.Id, messageId, client, options);


public static async Task DeleteMessagesAsync(ITextChannel channel, BaseDiscordClient client, public static async Task DeleteMessagesAsync(ITextChannel channel, BaseDiscordClient client,
IEnumerable<ulong> messageIds, RequestOptions options) IEnumerable<ulong> messageIds, RequestOptions options)


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

@@ -1,4 +1,4 @@
using Discord.API.Rest;
using Discord.API.Rest;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Immutable; using System.Collections.Immutable;
@@ -22,10 +22,12 @@ namespace Discord.Rest
}; };
return await client.ApiClient.ModifyMessageAsync(msg.Channel.Id, msg.Id, apiArgs, options).ConfigureAwait(false); return await client.ApiClient.ModifyMessageAsync(msg.Channel.Id, msg.Id, apiArgs, options).ConfigureAwait(false);
} }
public static async Task DeleteAsync(IMessage msg, BaseDiscordClient client,
public static Task DeleteAsync(IMessage msg, BaseDiscordClient client, RequestOptions options)
=> DeleteAsync(msg.Channel.Id, msg.Id, client, options);
public static async Task DeleteAsync(ulong channelId, ulong msgId, BaseDiscordClient client,
RequestOptions options) RequestOptions options)
{ {
await client.ApiClient.DeleteMessageAsync(msg.Channel.Id, msg.Id, options).ConfigureAwait(false);
await client.ApiClient.DeleteMessageAsync(channelId, msgId, options).ConfigureAwait(false);
} }


public static async Task AddReactionAsync(IMessage msg, IEmote emote, BaseDiscordClient client, RequestOptions options) public static async Task AddReactionAsync(IMessage msg, IEmote emote, BaseDiscordClient client, RequestOptions options)


Loading…
Cancel
Save