Python 3.x 我从Heroku那里得到一个关于不和谐意图的错误(Discord.py)

Python 3.x 我从Heroku那里得到一个关于不和谐意图的错误(Discord.py),python-3.x,discord.py,Python 3.x,Discord.py,我正在使用Heroku来托管我的discord bot,但我收到一个错误消息 2021-05-22T13:49:05.066399+00:00 app[worker.1]: File "/app/Discord.py", line 6, in <module> 2021-05-22T13:49:05.066599+00:00 app[worker.1]: intents = discord.Intents(messages=True, guilds=True, r

我正在使用Heroku来托管我的discord bot,但我收到一个错误消息

2021-05-22T13:49:05.066399+00:00 app[worker.1]: File "/app/Discord.py", line 6, in <module>
2021-05-22T13:49:05.066599+00:00 app[worker.1]: intents = discord.Intents(messages=True, guilds=True, reactions=True, members=True, presences=True)
2021-05-22T13:49:05.066604+00:00 app[worker.1]: AttributeError: module 'discord' has no attribute 'Intents'
第6行是
intents=discord.intents(messages=True,guilds=True,reactions=True,members=True,presence=True)


这就是问题所在,有人能帮我吗?我是Discord.py的新手

您需要升级您的Discord.py版本。这可以通过在
requirements.txt
文件中指定所需的版本来实现。您可以通过执行
discord来检查您的discord.py版本。最新版本是
1.7.2
,并将其放入
requirements.txt
中,您需要将
discord.py>=1.7.2


如果您想使用所有的意图,那么最好使用
discord.intents.all()
而不是指定要使用的意图。

将第6行更改为:
discord.intents.all()
谢谢,我的需求中添加了discord 1.3
import discord
from discord.ext import commands
import random
from kewl import *

intents = discord.Intents(messages=True, guilds=True, reactions=True, members=True, presences=True)
client = commands.Bot(command_prefix='$', intents=intents)
role = ""

# 290 lines of code

client.run(Token)