【问题标题】:__init__() missing 1 required keyword-only argument: 'intents' discord__init__() 缺少 1 个必需的仅关键字参数:\'intents\' discord
【发布时间】:2022-11-17 22:53:55
【问题描述】:

我试图制作一个不和谐的机器人,我使用了这段代码:

import discord
from discord.ext import commands

bot=commands.Bot(command_prefix='/')

@bot.event

async def on_ready():
print("Black_knight is up again")\`

并弹出此错误:

line 6, in \<module\>
bot=commands.Bot(command_prefix='/')
TypeError: __init__() missing 1 required keyword-only argument: 'intents'

另外,我试着把

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

bot.commands之前,但仍然得到同样的错误。

【问题讨论】:

    标签: python discord discord.py python-3.8


    【解决方案1】:

    此代码应该有效,但它导入了所有意图

    intents = discord.Intents().all()
    client = commands.Bot(command_prefix=',', intents=intents)
    

    【讨论】:

      猜你喜欢
      • 2022-10-09
      • 2022-08-19
      • 2022-10-30
      • 2022-10-06
      • 2018-07-26
      • 2018-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多