不确定如何在Heroku服务器上使用Intent [英] Not sure how to use intents on heroku server

查看:52
本文介绍了不确定如何在Heroku服务器上使用Intent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在计算机上运行discord bot时,但当我将代码上传到heroku时,一切正常.我收到此错误消息.

I have everything working when I run my discord bot on my computer, but when I upload my code into heroku. I get this error message.

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'

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

I'm not sure if I forgot to add something to my requirements folder or something, but everything works fine on my pc.

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

推荐答案

discord.py意向要求版本1.5以上(请参见 discord.py docs ),您的版本是1.4.x.要解决此问题,只需将 requirements.txt 更新为兼容版本.

discord.py Intents require version 1.5+ (see discord.py docs), you have version 1.4.x. To fix this issue, just update requirements.txt to a compatible version.

旁注:为什么您在 requirements.txt 中将discord.py列出3次并包含 asyncio (自3.4开始就已存在于stdlib中)?

Side note: Why do you have discord.py listed 3 times in requirements.txt and include asyncio, which has been in the stdlib since 3.4?

这篇关于不确定如何在Heroku服务器上使用Intent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆