【问题标题】:TypeError: BotBase.__init__() missing 1 required keyword-only argument: 'intents'TypeError: BotBase.__init__() 缺少 1 个必需的仅关键字参数:\'intents\'
【发布时间】:2022-10-30 22:49:10
【问题描述】:

所以我制作了一个不和谐的自我机器人:

prefix = input("\033[0;96m[~\033[0;96m] \033[0;96mPREFIX - ")
client = commands.Bot(command_prefix=prefix, case_insensitive=True,
                  self_bot=True)
client.remove_command('help')
header = {"Authorization": f'Bot {token}'}
os.system('cls' if os.name == 'nt' else 'clear')
os.system('cls' if os.name == 'nt' else 'clear')
#yt links doesnt work
intents = discord.Intents.all()
intents.members = True

但随后此错误不断出现

TypeError: BotBase.__init__() missing 1 required keyword-only argument: 'intents'

【问题讨论】:

标签: python discord.py


【解决方案1】:

您需要在客户端中指定意图参数,我这样做了:

client = commands.Bot(command_prefix=prefix, intents=discord.Intents.all(), case_insensitive=True, self_bot=True)

它应该工作。

【讨论】:

    【解决方案2】:

    您的代码的第一部分应该是:

    prefix = input("[0;96m[~[0;96m] [0;96mPREFIX - ")
    
    intents = discord.Intents.all()
    intents.members = True
    
    client = discord.Bot(command_prefix=prefix, case_insensitive=True,
                      self_bot=True)
    

    这应该可以消除您的错误

    【讨论】:

      猜你喜欢
      • 2022-08-19
      • 2022-11-17
      • 2022-10-09
      • 2022-10-06
      • 2018-07-26
      • 2019-06-25
      • 2021-06-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多