Skip to content

Commit

Permalink
Added "around" direction
Browse files Browse the repository at this point in the history
  • Loading branch information
Auralytical committed Jun 18, 2016
1 parent 03c0f67 commit 2b5bc17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Discord.Net/Enums/Relative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
public enum Relative
{
Before, After
Before, After, Around
}
}
9 changes: 8 additions & 1 deletion src/Discord.Net/Models/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,17 @@ public async Task<Message[]> DownloadMessages(int limit = 100, ulong? relativeMe

try
{
string dir;
switch (relativeDir)
{
case Relative.Before: default: dir = "before"; break;
case Relative.After: dir = "after"; break;
case Relative.Around: dir = "around"; break;
}
var request = new GetMessagesRequest(Id)
{
Limit = limit,
RelativeDir = relativeMessageId.HasValue ? relativeDir == Relative.Before ? "before" : "after" : null,
RelativeDir = relativeMessageId.HasValue ? dir : null,
RelativeId = relativeMessageId ?? 0
};
var msgs = await Client.ClientAPI.Send(request).ConfigureAwait(false);
Expand Down

0 comments on commit 2b5bc17

Please sign in to comment.