python - discord.py/PIL 发送图像/gif 文件错误 50006
问题描述
我正在处理 discord.py plus PIL 上的一些图像/gif 文件,但有时当我尝试从文件发送图像/gif 时,它会给我这个错误:
Ignoring exception in command battle:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "./discordbot.py", line 1487, in battle
await battlevs(ctx, int(o))
File "./discordbot.py", line 1838, in battlevs
await ctx.send(file=file)
File "/usr/local/lib/python3.6/site-packages/discord/abc.py", line 1047, in send
message_reference=reference)
File "/usr/local/lib/python3.6/site-packages/discord/http.py", line 254, in request
raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/usr/local/lib/python3.6/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/usr/local/lib/python3.6/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message
(该文件在一个名为battlevs 的函数中发送) 我的源代码大约有200 行,所以除非真的需要,否则我不会在这里发布它。请帮忙。
解决方案
推荐阅读
- binding - 有没有办法在 SwiftUI 中的特定索引处的枚举中创建计算数组属性的绑定?
- java - 在 * 上运行 Tomcat:
而不是本地主机: - python - sorted() 不是排序列表
- c++ - 对 C++ 中的字符感到困惑,发出 memsetting
- javascript - 使用实时可发布密钥时不生成条带令牌
- html - 我可以让固定文本在横幅之后消失吗?
- java - Spring Boot for Kafka - 一个应用程序中的多个 KafkaStreams 配置
- vuex - Vuex 变量正确更新但未在模板中刷新
- reactjs - 单击任何链接时如何关闭侧边栏?
- c++ - 在 BinomialHeap 实现中使用 union(x, y) 中的删除