Discord 我怎样才能改变我的;勾选“;不犯错误?
我试图发出一个“反应角色命令”,但错误是 命令引发异常:TypeError:check()接受1个位置参数,但提供了2个Discord 我怎样才能改变我的;勾选“;不犯错误?,discord,discord.py,Discord,Discord.py,我试图发出一个“反应角色命令”,但错误是 命令引发异常:TypeError:check()接受1个位置参数,但提供了2个 我如何解决这个问题?问题在于您的反应和12944qwerty提到的添加检查。反应添加msg1=等待客户端。等待('reaction\u add,check=check)使用您的检查功能 @client.command(name="reactionrole", description="none") async def reactionr
我如何解决这个问题?问题在于您的反应和12944qwerty提到的添加检查。反应添加
msg1=等待客户端。等待('reaction\u add,check=check)
使用您的检查功能
@client.command(name="reactionrole", description="none")
async def reactionrole_cmd(ctx):
def check(m):
return m.author == ctx.author
choose_reaction = discord.Embed(
title = "Step one | Choose reaction",
description = "**React** to this message with the reaction trigger",
color = 0x78AFD0
)
await ctx.send(embed=choose_reaction)
msg1 = await client.wait_for('reaction_add', check=check)
find_message = discord.Embed(
title = "Step two | Find Message",
description = "**Mention** the channel this message is in.",
color = 0x78AFD0
)
await ctx.send(embed=find_message)
msg2 = await client.wait_for('channel_mentions', check=check)
await ctx.send("hi")
但是reaction\u add需要两个参数reaction
和user
,因此您需要更改您的检查以同时接受reaction和user,执行类似的操作
def check(m):
return user == ctx.author
对于
反应\u add
检查,需要两个参数<代码>反应和用户
中order@12944qwerty我真的不知道你的意思你知道事情是如何运作的吗<代码>在消息上,在反应上添加
,等等wait_for()
的工作方式与此相同。第一个参数是事件的名称(不带上的),参数完全相同
def check(reaction, user):
return user == ctx.author