Ignore messages with an ID of 0 when calculating age

This commit is contained in:
Christopher F
2017-11-06 20:40:59 -05:00
parent 14fbe40cbc
commit 676be4081b

View File

@@ -188,6 +188,7 @@ namespace Discord
var minimum = SnowflakeUtils.ToSnowflake(DateTimeOffset.UtcNow.Subtract(TimeSpan.FromDays(14))); var minimum = SnowflakeUtils.ToSnowflake(DateTimeOffset.UtcNow.Subtract(TimeSpan.FromDays(14)));
for (var i = 0; i < collection.Length; i++) for (var i = 0; i < collection.Length; i++)
{ {
if (collection[i] == 0) continue;
if (collection[i] <= minimum) if (collection[i] <= minimum)
throw new ArgumentOutOfRangeException(name, "Messages must be younger than two weeks old."); throw new ArgumentOutOfRangeException(name, "Messages must be younger than two weeks old.");
} }