So I've recently switched to a client to bot as I've been told it a lot better than using the client. I asked a question a few weeks ago about a text-based game you can see it here How to use commands only when a current command is triggered?
Somebody gave me an example of my question however the code doesn't work for some reason. All of my other commands work fine.
class Game:
def __init__(self):
self.points = 0
self.inventory = []
sessions = {}
@bot.command(pass_context=True)
async def play(ctx):
if ctx.message.author.id in sessions:
await bot.say("You're already playing")
return
sessions[ctx.message.author.id] = Game()
await bot.say("Welcome to the game!")