dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
665 stars 155 forks source link

Discord returns 413 when i trying to upload large (233 МB) file #505

Closed Vazgen005 closed 1 year ago

Vazgen005 commented 1 year ago

Summary

title

Reproduction Steps

image File weight: 233 МB (245 033 484 bytes)

Code

import discord
from discord.ext import commands

# region config
TOKEN = "TOKEN"
# endregion

bot = commands.Bot(command_prefix='>', self_bot=True)

@bot.command()
async def test(ctx):
    await ctx.send("large_file", file=discord.File(fp=".\\file.webm", filename=f"file.webm"))

bot.run(TOKEN)

Expected Results

successfully sent file

Actual Results

2023-05-09 03:50:35 INFO discord.client Logging in using static token. 2023-05-09 03:50:38 INFO discord.http Found user agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36, build number 196448. 2023-05-09 03:50:39 INFO discord.gateway Connected to Gateway (Session ID: 752917b76b7e5227acf7a84317b40ffd). 2023-05-09 03:51:05 ERROR discord.ext.commands.bot Ignoring exception in command test Traceback (most recent call last): File "C:\Users\vaz05\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\core.py", line 236, in wrapped ret = await coro(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\vaz05\Desktop\code\Python\selfbot-v2\test.py", line 12, in test await ctx.send("large_file", file=discord.File(fp=".\file.webm", filename=f"file.webm")) File "C:\Users\vaz05\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\abc.py", line 1664, in send data = await state.http.send_message(channel.id, params=params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\vaz05\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\http.py", line 838, in request raise HTTPException(response, data) discord.errors.HTTPException: 413 Request Entity Too Large (error code: 0):

413 Request Entity Too Large

413 Request Entity Too Large


cloudflare

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 413 Request Entity Too Large (error code: 0):

413 Request Entity Too Large

413 Request Entity Too Large


cloudflare

System Information

Checklist

Additional Information

Yes, i have nitro on my acc

slpkbt commented 1 year ago

yes plis fix wery important!💀

dolfies commented 1 year ago

100mb+ uploads require you to use the new GCP pre-upload system instead of legacy uploads. This is implemented in the development build, so you have to install the library from the master branch. The discord.CloudFile objects can simply be used in place of discord.File in your code, and can be reused as many times as you want!