当我在cog文件中为discord bot使用wait_for()
时,出现了一个意外错误
错误说明:
wait_for()
got an unexpected keyword argument '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) == "🔧" or str(reaction.emoji) == "🚜")
if avance == 2:
return user == ctx.message.author and message.id == reaction.message.id and (str(reaction.emoji) == "✅" or str(reaction.emoji) == "❌")
#Message de commencement
await ctx.send(f"""```diff\n+ Aprés être rentrer dans la grange.\n+ {ctx.message.author.name} voit énormément d'outils agricoles, ainsi qu'un vieux tracteur !```""")
await asyncio.sleep(1)
message = await ctx.send(f"""```diff\n- Souhaitez-vous regardé ces outils agricoles 🔧 ou le tracteur 🚜 ?```""")
#choix de la fouille
await message.add_reaction("🔧")
await message.add_reaction("🚜")
#situation en fonction de la reaction
try:
reaction, user = await asyncio.wait_for("reaction_add", timeout = 10, check = checkEmojiGrange)
except Exception as e:
print(e)
await ctx.send("La fouille à été annulée automatiquement.")
messages = await ctx.channel.history(limit=0+3).flatten()
await asyncio.sleep(4)
for message in messages:
await message.delete()
tourGrange, finGrange = True, 1
return
我创造了它,现在它说:
所以我设置如下:
现在:
这是因为您应该使用} 对象
await client.wait_for()
,其中client
是您的^{因此,在您的代码中,请使用:
而不是:
^{} 没有check关键字。您必须改用^{}
相关问题 更多 >
编程相关推荐