from discord.ext import commands import discord import asyncio def check_for_mention_1_player(message): if len(message.mentions) == 1: return True else: return False def accept(message): return True class UnoGameCog(commands.Cog): def __init__(self, client): self.client = client @commands.command() async def uno_create(self, ctx): if self.client.get_channel(ctx.channel.id) == self.client.get_channel(555052075306713109): embed = discord.Embed(colour=discord.Colour.purple()) embed.set_author(name="How many players?") msg = await ctx.send(embed=embed) await msg.add_reaction('2⃣') await msg.add_reaction('3⃣') await asyncio.sleep(1) try: reaction, user = await self.client.wait_for('reaction_add', timeout=20.0) if str(reaction) == '2⃣' and ctx.author == user: embed.set_author(name="Cool, mention the other player") await msg.edit(embed=embed) message = await self.client.wait_for('message', timeout=20.0, check=check_for_mention_1_player) embed.set_author(name="Awesome, that user has 20 seconds to say \"accept\" in chat") await msg.edit(embed=embed) await self.client.wait_for('message', timeout=20.0, check=accept) except asyncio.TimeoutError: await ctx.send("time out or incorrect query") def setup(client): client.add_cog(UnoGameCog(client))