fix: cap cache_url at 100 MiB, the largest upload a bot can make

bots can't have nitro, so discord's largest upload a bot can make is a boost
tier 3 guild's 104857600 bytes (discord.py Guild.filesize_limit). 500 MiB
admitted bodies no bot upload could carry.

Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
dsql committed 2026-10-16 04:20:08 -04:00
1 parent 40d38661d1
commit caf0c3ee5c
1 file changed
+4 -3
+4 -3
View File
@@ -61,9 +61,10 @@ import discord
log = logging.getLogger(__name__)
MAX_ATTACHMENTS_PER_MESSAGE = 10
# cache_url's body cap: discord's largest upload tier (500 MB, nitro), so nothing discord would
# accept is refused; it bounds memory, it is not the bot's real (per-guild) upload limit
MAX_CACHE_URL_BYTES = 500 * 1024 * 1024
# cache_url's body cap: the largest upload a BOT can make (boost tier 3 guild,
# discord.py Guild.filesize_limit 104857600; bots can't have nitro), so nothing discord would
# accept from a bot is refused; it bounds memory, not the channel's own (tier) limit
MAX_CACHE_URL_BYTES = 100 * 1024 * 1024
FileContent = Union[bytes, bytearray, str, "os.PathLike[str]", discord.File]