Actually use GetMessages(beforeMessageId)

This commit is contained in:
RogueException
2015-10-26 14:04:13 -03:00
parent 1ce82912f3
commit 2ba268e892
3 changed files with 7 additions and 3 deletions

View File

@@ -16,6 +16,7 @@
public static string ChannelTyping(string channelId) => $"channels/{channelId}/typing";
public static string ChannelMessages(string channelId) => $"channels/{channelId}/messages";
public static string ChannelMessages(string channelId, int limit) => $"channels/{channelId}/messages?limit={limit}";
public static string ChannelMessages(string channelId, int limit, string beforeId) => $"channels/{channelId}/messages?limit={limit}&before={beforeId}";
public static string ChannelMessage(string channelId, string msgId) => $"channels/{channelId}/messages/{msgId}";
public static string ChannelMessageAck(string channelId, string msgId) => $"channels/{channelId}/messages/{msgId}/ack";
public static string ChannelInvites(string channelId) => $"channels/{channelId}/invites";

View File

@@ -92,11 +92,14 @@ namespace Discord
var request = new ReorderChannelsRequest(channels);
return _rest.Patch(Endpoints.ServerChannels(serverId), request);
}
public Task<GetMessagesResponse> GetMessages(string channelId, int count)
public Task<GetMessagesResponse> GetMessages(string channelId, int count, string beforeMessageId = null)
{
if (channelId == null) throw new ArgumentNullException(nameof(channelId));
return _rest.Get<GetMessagesResponse>(Endpoints.ChannelMessages(channelId, count));
if (beforeMessageId != null)
return _rest.Get<GetMessagesResponse>(Endpoints.ChannelMessages(channelId, count, beforeMessageId));
else
return _rest.Get<GetMessagesResponse>(Endpoints.ChannelMessages(channelId, count));
}
//Incidents

View File

@@ -210,7 +210,7 @@ namespace Discord
{
try
{
var msgs = await _api.GetMessages(channel.Id, count).ConfigureAwait(false);
var msgs = await _api.GetMessages(channel.Id, count, beforeMessageId).ConfigureAwait(false);
return msgs.Select(x =>
{
Message msg = null;