geirawsm / sausage_bot

Another Discord-bot
1 stars 0 forks source link

Bug when trying to `!youtube list` and the output exceeds Discords post length #26

Closed geirawsm closed 1 year ago

geirawsm commented 1 year ago
2022-12-16 15:37:03 ERROR    discord.ext.commands.bot Ignoring exception in command youtube list
Traceback (most recent call last):
  File "/home/geirawsm/.local/share/virtualenvs/dissonancebot-Ho5F9GWc/lib/python3.10/site-packages/discord/ext/commands/core.py", line 229, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/geirawsm/scripts/discord/dissonancebot/sausage_bot/cogs/youtube.py", line 189, in list_youtube
    await ctx.send(list_format)
  File "/home/geirawsm/.local/share/virtualenvs/dissonancebot-Ho5F9GWc/lib/python3.10/site-packages/discord/ext/commands/context.py", line 842, in send
    return await super().send(
  File "/home/geirawsm/.local/share/virtualenvs/dissonancebot-Ho5F9GWc/lib/python3.10/site-packages/discord/abc.py", line 1538, in send
    data = await state.http.send_message(channel.id, params=params)
  File "/home/geirawsm/.local/share/virtualenvs/dissonancebot-Ho5F9GWc/lib/python3.10/site-packages/discord/http.py", line 744, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In content: Must be 2000 or fewer in length.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/geirawsm/.local/share/virtualenvs/dissonancebot-Ho5F9GWc/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1349, in invoke
    await ctx.command.invoke(ctx)
  File "/home/geirawsm/.local/share/virtualenvs/dissonancebot-Ho5F9GWc/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1642, in invoke
    await ctx.invoked_subcommand.invoke(ctx)
  File "/home/geirawsm/.local/share/virtualenvs/dissonancebot-Ho5F9GWc/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1636, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "/home/geirawsm/.local/share/virtualenvs/dissonancebot-Ho5F9GWc/lib/python3.10/site-packages/discord/ext/commands/core.py", line 238, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In content: Must be 2000 or fewer in length.

Solution split or paginate output?

geirawsm commented 1 year ago

9bb98d56f3939955ad78a034ccec20c1c6802f7d