Improved DownloadMessages' bad permission handling

This commit is contained in:
RogueException
2015-11-16 15:59:23 -04:00
parent ce247278da
commit 1e21462eb5

View File

@@ -217,7 +217,7 @@ namespace Discord
/// <summary> Downloads last count messages from the server, returning all messages before or after relativeMessageId, if it's provided. </summary>
public async Task<Message[]> DownloadMessages(Channel channel, int count, string relativeMessageId = null, RelativeDirection relativeDir = RelativeDirection.Before, bool cache = true)
public async Task<Message[]> DownloadMessages(Channel channel, int count, string relativeMessageId = null, RelativeDirection relativeDir = RelativeDirection.Before, bool cache = false)
{
if (channel == null) throw new ArgumentNullException(nameof(channel));
if (count < 0) throw new ArgumentNullException(nameof(count));
@@ -252,7 +252,7 @@ namespace Discord
})
.ToArray();
}
catch (HttpException) { } //Bad Permissions?
catch (HttpException ex) when (ex.StatusCode == HttpStatusCode.Forbidden){ } //Bad Permissions
}
return null;
}