Browse Source

Renamed RelativeDirection to Relative

pull/22/head
RogueException 9 years ago
parent
commit
2efcd3675d
5 changed files with 12 additions and 17 deletions
  1. +2
    -2
      src/Discord.Net.Net45/Discord.Net.csproj
  2. +1
    -1
      src/Discord.Net/Legacy.cs
  3. +2
    -2
      src/Discord.Net/Models/Channel.cs
  4. +7
    -0
      src/Discord.Net/Relative.cs
  5. +0
    -12
      src/Discord.Net/RelativeDirection.cs

+ 2
- 2
src/Discord.Net.Net45/Discord.Net.csproj View File

@@ -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>


+ 1
- 1
src/Discord.Net/Legacy.cs View File

@@ -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);


+ 2
- 2
src/Discord.Net/Models/Channel.cs View File

@@ -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);


+ 7
- 0
src/Discord.Net/Relative.cs View File

@@ -0,0 +1,7 @@
namespace Discord
{
public enum Relative
{
Before, After
}
}

+ 0
- 12
src/Discord.Net/RelativeDirection.cs View File

@@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Discord
{
public enum RelativeDirection
{
Before, After
}
}

Loading…
Cancel
Save