using lambda method bc it's stylé

This commit is contained in:
Mylloon 2021-06-24 16:00:37 +02:00
parent 7306ab84ab
commit 21916b9935

View file

@ -68,10 +68,7 @@ class Games(commands.Cog):
await ctx.send(message) await ctx.send(message)
while self.guessing_game[str(ctx.author.id)] != 0: while self.guessing_game[str(ctx.author.id)] != 0:
try: try:
def check(message): msg = await self.client.wait_for('message', check = lambda message: str(message.author.id) in self.guessing_game if message.author.bot == False else None, timeout = 30)
if message.author.bot == False:
return str(message.author.id) in self.guessing_game
msg = await self.client.wait_for('message', check = check, timeout = 30)
except asyncio.TimeoutError: except asyncio.TimeoutError:
del self.guessing_game[str(ctx.author.id)] del self.guessing_game[str(ctx.author.id)]
return await ctx.send(f"Tu as mis trop de temps a répondre {ctx.author.mention}. La réponse était {number}.") return await ctx.send(f"Tu as mis trop de temps a répondre {ctx.author.mention}. La réponse était {number}.")