Actually use GetMessages(beforeMessageId)
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
public static string ChannelTyping(string channelId) => $"channels/{channelId}/typing";
|
public static string ChannelTyping(string channelId) => $"channels/{channelId}/typing";
|
||||||
public static string ChannelMessages(string channelId) => $"channels/{channelId}/messages";
|
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) => $"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 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 ChannelMessageAck(string channelId, string msgId) => $"channels/{channelId}/messages/{msgId}/ack";
|
||||||
public static string ChannelInvites(string channelId) => $"channels/{channelId}/invites";
|
public static string ChannelInvites(string channelId) => $"channels/{channelId}/invites";
|
||||||
|
|||||||
@@ -92,11 +92,14 @@ namespace Discord
|
|||||||
var request = new ReorderChannelsRequest(channels);
|
var request = new ReorderChannelsRequest(channels);
|
||||||
return _rest.Patch(Endpoints.ServerChannels(serverId), request);
|
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));
|
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
|
//Incidents
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ namespace Discord
|
|||||||
{
|
{
|
||||||
try
|
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 =>
|
return msgs.Select(x =>
|
||||||
{
|
{
|
||||||
Message msg = null;
|
Message msg = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user