Browse Source

Added single message GET endpoint

pull/97/head
RogueException 9 years ago
parent
commit
eb7ab454b3
1 changed files with 3 additions and 7 deletions
  1. +3
    -7
      src/Discord.Net/API/DiscordAPIClient.cs

+ 3
- 7
src/Discord.Net/API/DiscordAPIClient.cs View File

@@ -817,15 +817,11 @@ namespace Discord.API
Preconditions.NotEqual(channelId, 0, nameof(channelId));
Preconditions.NotEqual(messageId, 0, nameof(messageId));

//TODO: Improve when Discord adds support
var msgs = await GetChannelMessagesAsync(channelId, new GetChannelMessagesParams { Limit = 1, RelativeDirection = Direction.Before, RelativeMessageId = messageId + 1 }).ConfigureAwait(false);
return msgs.FirstOrDefault();

/*try
try
{
return await Send<Message>("GET", $"channels/{channelId}/messages/{messageId}", options: options).ConfigureAwait(false);
return await SendAsync<Message>("GET", $"channels/{channelId}/messages/{messageId}", options: options).ConfigureAwait(false);
}
catch (HttpException ex) when (ex.StatusCode == HttpStatusCode.NotFound) { return null; }*/
catch (HttpException ex) when (ex.StatusCode == HttpStatusCode.NotFound) { return null; }
}
public async Task<IReadOnlyCollection<Message>> GetChannelMessagesAsync(ulong channelId, GetChannelMessagesParams args, RequestOptions options = null)
{


Loading…
Cancel
Save