0

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!")
Abhijith Konnayil
  • 4,067
  • 6
  • 23
  • 49
Cupcake
  • 37
  • 1
  • 4
  • 14
  • Please double check your indentation, it's important in python. Is this the entirety of your code? Are you doing `bot.run("TOKEN")` at the end? Are you seeing any errors in the console when you try to invoke the command? – Patrick Haugh Jul 09 '18 at 01:59
  • No this is not my entire code you can check my entire code on github (https://github.com/CakeCode123/Cakebot/blob/master/bot.py) and yes i think i have my indentation correct and i also have 'bot.run("token)' there you can double check it if i'm wrong. – Cupcake Jul 09 '18 at 02:22

0 Answers0