mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Fix filesize checker
This commit is contained in:
parent
c7b326899b
commit
4ca6b7f1d9
1 changed files with 3 additions and 3 deletions
|
@ -914,7 +914,7 @@ class OtherCog(commands.Cog):
|
||||||
MAX_SIZE_MB = ctx.guild.filesize_limit / 1024 / 1024
|
MAX_SIZE_MB = ctx.guild.filesize_limit / 1024 / 1024
|
||||||
if MAX_SIZE_MB == 8.0:
|
if MAX_SIZE_MB == 8.0:
|
||||||
MAX_SIZE_MB = 25.0
|
MAX_SIZE_MB = 25.0
|
||||||
|
REAL_MAX_SIZE_MB = MAX_SIZE_MB
|
||||||
if disable_filesize_buffer is False:
|
if disable_filesize_buffer is False:
|
||||||
MAX_SIZE_MB *= 0.9
|
MAX_SIZE_MB *= 0.9
|
||||||
BYTES_REMAINING = (MAX_SIZE_MB - 0.256) * 1024 * 1024
|
BYTES_REMAINING = (MAX_SIZE_MB - 0.256) * 1024 * 1024
|
||||||
|
@ -1129,7 +1129,7 @@ class OtherCog(commands.Cog):
|
||||||
embed.description += f"\N{warning sign}\ufe0f {file.name} is empty.\n"
|
embed.description += f"\N{warning sign}\ufe0f {file.name} is empty.\n"
|
||||||
continue
|
continue
|
||||||
st = file.stat().st_size
|
st = file.stat().st_size
|
||||||
if st / 1024 / 1024 >= MAX_SIZE_MB or st >= BYTES_REMAINING:
|
if st / 1024 / 1024 >= REAL_MAX_SIZE_MB:
|
||||||
units = ["B", "KB", "MB", "GB", "TB"]
|
units = ["B", "KB", "MB", "GB", "TB"]
|
||||||
st_r = st
|
st_r = st
|
||||||
while st_r > 1024:
|
while st_r > 1024:
|
||||||
|
@ -1140,7 +1140,7 @@ class OtherCog(commands.Cog):
|
||||||
file.name,
|
file.name,
|
||||||
round(st_r, 2),
|
round(st_r, 2),
|
||||||
units[0],
|
units[0],
|
||||||
MAX_SIZE_MB,
|
REAL_MAX_SIZE_MB,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue