'discord.py 1vs1 game - accept invite function

Im making a 1vs1 game that sends invite to user and awaits for accept. Here is my code:

global hasRun
hasRun = False
@client.command()
async def accept(ctx):
    global hasRun
    hasRun = True

@client.command() 
async def fight(ctx, user: discord.Member):
    await ctx.send('sending invite to user')
    await user.send('press `/accept` to start the game')
    await ctx.send('waiting for accept..')
    global hasRun
    if hasRun == True:
      await ctx.send("game started")

Code doesnt drop any error but it just doesnt work. Any idea where the fault lies?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source