Python-Discord.py-wait_for()我的Cog的意外关键字
我在cog文件中为我的discord bot使用Python-Discord.py-wait_for()我的Cog的意外关键字,python,discord.py,Python,Discord.py,我在cog文件中为我的discord bot使用wait_for()时出现意外错误 错误说明: wait_for()获取了意外的关键字参数“check” 我怎样才能解决这个问题 守则: while tourGrange == True and finGrange == 0: tourGrange = False avance = 0 choix = random.choice(situation)
wait_for()
时出现意外错误
错误说明:
wait_for()
获取了意外的关键字参数“check”
我怎样才能解决这个问题
守则:
while tourGrange == True and finGrange == 0:
tourGrange = False
avance = 0
choix = random.choice(situation)
await ctx.message.delete()
outilsMecanique = ["Clé à molette", "Clé à tube", "Pinces combinées", "Marteau à griffes", "Tournevis", "clé"]
outilsAgricole = ["Faux", "Hache", "Binette", "Pelle", "Rateau", "Scie", "Brouette", "clé"]
avance = 1
#Vérifie l'auteur de la réaction
def checkEmojiGrange(reaction, user):
if avance == 1:
return user == ctx.message.author and message.id == reaction.message.id and (str(reaction.emoji) == "asyncio.wait_for
doesn't have check keyword. You have to use client.wait_for
instead.This is because you should use await client.wait_for()
where client
is your discord.Client
object.
So, in your code, use:
reaction, user = await client.wait_for("reaction_add", timeout = 10, check = checkEmojiGrange)
当tourGrange==True和finGrange==0时:
tourGrange=假
前卫=0
choix=随机选择(情况)
等待ctx.message.delete()
outilsMecanique=[“色拉莫莱特”、“色拉管”、“夹钳组合”、“玛托格里夫斯”、“图尔尼维斯”、“色拉”]
outilsAgricole=[“人造”、“哈切”、“比内特”、“佩尔”、“拉托”、“Scie”、“布鲁内特”、“克莱”]
前卫=1
#行动导演
def检查范围(反应,用户):
如果avance==1:
return user==ctx.message.author和message.id==reaction.message.id和(str(reaction.emoji)=“没有check关键字。您必须改用它。这是因为您应该使用等待客户端。等待()
其中客户端
是您的对象
因此,在您的代码中,请使用:
反应,用户=等待客户端。等待(“反应添加”,超时=10,检查=检查范围)
而不是:
reaction,user=wait asyncio.wait\u for(“reaction\u add”,timeout=10,check=checkemogingrange)
我创建了它,现在它说:
wait_for()缺少1个必需的位置参数:“事件”
所以我设置如下:
reaction, user = await client.wait_for(event = "reaction_add", timeout = 10, check = checkEmojiGrange)
现在:
wait_for()缺少1个必需的位置参数:“self”
对于“自我”论证,我添加如下内容:
reaction, user = await client.wait_for(self, event = "reaction_add", timeout = 10, check = checkEmojiGrange)
现在它说:
“CogFouiller”对象没有属性“loop”