不确定如何在heroku服务器上使用意图

2024-05-13 20:14:46 发布

您现在位置:Python中文网/ 问答频道 /正文

当我在电脑上运行discord机器人时,我的一切都正常工作,但当我将代码上传到heroku时。我收到了这个错误消息

2020-12-08T22:37:37.551623+00:00 app[worker.1]: Traceback (most recent call last):
2020-12-08T22:37:37.551649+00:00 app[worker.1]: File "bot.py", line 22, in <module>
2020-12-08T22:37:37.551751+00:00 app[worker.1]: intents = discord.Intents.default()
2020-12-08T22:37:37.551756+00:00 app[worker.1]: AttributeError: module 'discord' has no attribute 'Intents'

我不确定我是否忘了在我的需求文件夹中添加一些东西,但在我的电脑上一切正常

intents = discord.Intents.default()
intents.members = True

这是我的要求:

git+https://github.com/Rapptz/discord.py
PyNaCl==1.3.0
dnspython==1.16.0
requests
python-dotenv
gTTS
opuslib
asyncio
youtube-dl
discord
discord.py[voice] ~= 1.4.0
pip
ffmpeg
google-cloud-firestore
firebase-admin

Tags: 代码pyappdefault消息mostheroku错误
1条回答
网友
1楼 · 发布于 2024-05-13 20:14:46

discord.py意图需要版本1.5+(请参见discord.py docs),您有版本1.4.x。要解决此问题,只需将requirements.txt更新为兼容版本

旁注:为什么在requirements.txt和包含asyncio中列出了3次discord.py,它自3.4以来一直在stdlib中

相关问题 更多 >