title: So I'm trying to make it so you can see the number of commands which have been run on the bot but i'm getting an error
body: <pre><code>import discord
  from discord.ext import commands
  
  bot = commands.Bot(command_prefix=&quot;.&quot;)
  bot.remove_command('help')
  total_commands = 0
  total_usage = 0
  total_users = 0
  
  @bot.event
  async def on_ready():
    print(&quot;Bot is ready&quot;)
  
  @bot.command()
  async def help(ctx):
    await ctx.send(&quot;Which help page? say 'commands' for commands 'home' for home page&quot;)
  
    def check(msg):
      return msg.author == ctx.author and msg.channel == ctx.channel and \
          msg.content.lower() in [&quot;home&quot;, &quot;commands&quot;]
  
    msg = await bot.wait_for(&quot;message&quot;, check=check)
    if msg.content.lower() == &quot;home&quot;:
      embed = discord.Embed(title=&quot;**Home Menu**&quot;, description=f&quot;Total usage: {total_usage}\n\nTotal Commands Ran: {total_commands}\n\nTotal Users: {total_users}&quot;, color=discord.Color.from_rgb(0, 191, 255))
      embed.set_footer(icon_url=f&quot;{ctx.author.avatar_url}&quot;, text=&quot;Seppuku V2.0&quot;)
      await ctx.send(embed=embed)
      total_commands = total_commands + 1
  
    elif msg.content.lower() == &quot;commands&quot;:
      embed = discord.Embed(title=&quot;**Coming Soon**&quot;, description=&quot;**Coming Soon**&quot;, color=discord.Color.from_rgb(0, 191, 255))
      embed.set_footer(icon_url=f&quot;{ctx.author.avatar_url}&quot;, text=&quot;Seppuku V2.0&quot;)
      await ctx.send(embed=embed)
      total_commands = total_commands + 1
  </code></pre>
  <p>The error I am getting is with the <code>total_commands = total_commands + 1</code> line:</p>
  <blockquote>
  <p>local variable 'total_commands' defined in enclosing scope on line 8 referenced before assignment</p>
  </blockquote>
  <p>If someone could help that'd be nice :)</p>