title: Making a counter bot with Discord.py rewrite- local variable 'counter' referenced before assignment error
body: <p>I am attempting to make a counter in a discord bot that takes a number from the user and adds it to the current total. However I get  either a  " local variable 'counter' referenced before assignment" error or a "name counter is not defined" error.</p>
  
  <p>I have tried 2 variations while attempting to solve my problem.</p>
  
  <p>Variantion 1:</p>
  
  <pre><code>global counter
  @bot.command()
  async def bid(ctx,number):
      counter += number
      print(str(counter))
  </code></pre>
  
  <p>Variation 2:</p>
  
  <pre><code>@bot.command()
  async def bid(ctx,number):
      global counter
      counter += 1
      print(str(counter))  
  </code></pre>
  
  <p>Variation 1 was taken from a similar question post on StackOverflow. This is the code that returns a " local variable 'counter' referenced before assignment" error</p>
  
  <p>Variation 2 was also taken from a similar question (the same question actually just a different response). This is the code that returns "name counter is not defined" error.</p>
  
  <p>Expected result:</p>
  
  <p>I wish to create a command that lets the users increase the count. So lets say the count is currently at 0. I want to be able to say !bid 40 and have the count go to 40. If another user says !bid 20 I want the count to go to 60. </p>
  
  <p>What exactly is the problem in the code provided? Why is this happening? </p>