fix: Upload file size limit (#2313)

This commit is contained in:
Tripletri
2022-05-23 11:43:38 +05:00
committed by GitHub
parent 437c8a7f43
commit 54a5af7db4
6 changed files with 91 additions and 6 deletions

View File

@@ -132,12 +132,15 @@ namespace Discord.Rest
}
public static ulong GetUploadLimit(IGuild guild)
{
return guild.PremiumTier switch
var tierFactor = guild.PremiumTier switch
{
PremiumTier.Tier2 => 50ul * 1000000,
PremiumTier.Tier3 => 100ul * 1000000,
_ => 8ul * 1000000
PremiumTier.Tier2 => 50,
PremiumTier.Tier3 => 100,
_ => 8
};
var mebibyte = Math.Pow(2, 20);
return (ulong) (tierFactor * mebibyte);
}
#endregion
@@ -151,7 +154,7 @@ namespace Discord.Rest
if (fromUserId.HasValue)
return GetBansAsync(guild, client, fromUserId.Value + 1, Direction.Before, around + 1, options)
.Concat(GetBansAsync(guild, client, fromUserId.Value, Direction.After, around, options));
else
else
return GetBansAsync(guild, client, null, Direction.Before, around + 1, options);
}
@@ -908,7 +911,7 @@ namespace Discord.Rest
if (endTime != null && endTime <= startTime)
throw new ArgumentOutOfRangeException(nameof(endTime), $"{nameof(endTime)} cannot be before the start time");
var apiArgs = new CreateGuildScheduledEventParams()
{
ChannelId = channelId ?? Optional<ulong>.Unspecified,