From 2b5bc17e984e062f1f1bbea1242b2beb8c7ba96b Mon Sep 17 00:00:00 2001 From: RogueException Date: Fri, 17 Jun 2016 22:13:58 -0300 Subject: [PATCH] Added "around" direction --- src/Discord.Net/Enums/Relative.cs | 2 +- src/Discord.Net/Models/Channel.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net/Enums/Relative.cs b/src/Discord.Net/Enums/Relative.cs index 4bd44c5ab0..2c6ebf5f70 100644 --- a/src/Discord.Net/Enums/Relative.cs +++ b/src/Discord.Net/Enums/Relative.cs @@ -2,6 +2,6 @@ { public enum Relative { - Before, After + Before, After, Around } } diff --git a/src/Discord.Net/Models/Channel.cs b/src/Discord.Net/Models/Channel.cs index 03eb5d6101..0d0516d5d2 100644 --- a/src/Discord.Net/Models/Channel.cs +++ b/src/Discord.Net/Models/Channel.cs @@ -293,10 +293,17 @@ public async Task 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);