@@ -535,8 +535,8 @@ | |||||
<Compile Include="..\Discord.Net\ProfileEventArgs.cs"> | <Compile Include="..\Discord.Net\ProfileEventArgs.cs"> | ||||
<Link>ProfileEventArgs.cs</Link> | <Link>ProfileEventArgs.cs</Link> | ||||
</Compile> | </Compile> | ||||
<Compile Include="..\Discord.Net\RelativeDirection.cs"> | |||||
<Link>RelativeDirection.cs</Link> | |||||
<Compile Include="..\Discord.Net\Relative.cs"> | |||||
<Link>Relative.cs</Link> | |||||
</Compile> | </Compile> | ||||
<Compile Include="..\Discord.Net\RoleEventArgs.cs"> | <Compile Include="..\Discord.Net\RoleEventArgs.cs"> | ||||
<Link>RoleEventArgs.cs</Link> | <Link>RoleEventArgs.cs</Link> | ||||
@@ -163,7 +163,7 @@ namespace Discord.Legacy | |||||
} | } | ||||
[Obsolete("Use Channel.DownloadMessages")] | [Obsolete("Use Channel.DownloadMessages")] | ||||
public static Task<Message[]> DownloadMessages(this DiscordClient client, Channel channel, int limit = 100, ulong? relativeMessageId = null, RelativeDirection relativeDir = RelativeDirection.Before, bool useCache = true) | |||||
public static Task<Message[]> DownloadMessages(this DiscordClient client, Channel channel, int limit = 100, ulong? relativeMessageId = null, Relative relativeDir = Relative.Before, bool useCache = true) | |||||
{ | { | ||||
if (channel == null) throw new ArgumentNullException(nameof(channel)); | if (channel == null) throw new ArgumentNullException(nameof(channel)); | ||||
return channel.DownloadMessages(limit, relativeMessageId, relativeDir, useCache); | return channel.DownloadMessages(limit, relativeMessageId, relativeDir, useCache); | ||||
@@ -283,7 +283,7 @@ namespace Discord | |||||
} | } | ||||
public async Task<Message[]> DownloadMessages(int limit = 100, ulong? relativeMessageId = null, | public async Task<Message[]> DownloadMessages(int limit = 100, ulong? relativeMessageId = null, | ||||
RelativeDirection relativeDir = RelativeDirection.Before, bool useCache = true) | |||||
Relative relativeDir = Relative.Before, bool useCache = true) | |||||
{ | { | ||||
if (limit < 0) throw new ArgumentOutOfRangeException(nameof(limit)); | if (limit < 0) throw new ArgumentOutOfRangeException(nameof(limit)); | ||||
if (limit == 0 || Type != ChannelType.Text) return new Message[0]; | if (limit == 0 || Type != ChannelType.Text) return new Message[0]; | ||||
@@ -293,7 +293,7 @@ namespace Discord | |||||
var request = new GetMessagesRequest(Id) | var request = new GetMessagesRequest(Id) | ||||
{ | { | ||||
Limit = limit, | Limit = limit, | ||||
RelativeDir = relativeMessageId.HasValue ? relativeDir == RelativeDirection.Before ? "before" : "after" : null, | |||||
RelativeDir = relativeMessageId.HasValue ? relativeDir == Relative.Before ? "before" : "after" : null, | |||||
RelativeId = relativeMessageId ?? 0 | RelativeId = relativeMessageId ?? 0 | ||||
}; | }; | ||||
var msgs = await Client.ClientAPI.Send(request).ConfigureAwait(false); | var msgs = await Client.ClientAPI.Send(request).ConfigureAwait(false); | ||||
@@ -0,0 +1,7 @@ | |||||
namespace Discord | |||||
{ | |||||
public enum Relative | |||||
{ | |||||
Before, After | |||||
} | |||||
} |
@@ -1,12 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Threading.Tasks; | |||||
namespace Discord | |||||
{ | |||||
public enum RelativeDirection | |||||
{ | |||||
Before, After | |||||
} | |||||
} |