title: Discord.py on_message for loop not working
body: <p>Here is what I am trying to do:</p>
  
  <pre><code>@bot.event
  async def on_message(message):
  
  ans1GuessList = []
  ans2GuessList = []
  ans3GuessList = []
  
  if message.content.startswith("!1"):
  
      guessName1 = message.author.name
      ans1GuessList.append(guessName1)
  
  if message.content.startswith("!2"):
  
      guessName2 = message.author.name
      ans2GuessList.append(guessName2)
  
  if message.content.startswith("!3"):
  
      guessName3 = message.author.name
      ans3GuessList.append(guessName3)
  
  if message.content.startswith("!ans1correct"):
  
      if "admin" in [y.name.lower() for y in message.author.roles]:
  
          rewardListRaw = open("bank.txt", "rt")
          rewardList = rewardListRaw.read()
          rewardListRaw.close()
          print("Hello")
  
          for name in ans1GuessList:
  
              print("Goodbye")
  
              for item in rewardList.split("\n"):
  
                  if name in item:
  
                      itemList = item.split(":")
                      rewardLine = itemList[1]
                      balance = re.search(r'(\d+)', rewardLine)
                      print(balance)
                      newBalance = balance + 50
                      finalLine = string.replace(rewardLine, balance, newBalance)
                      print(finalLine)
  
                      l = fileinput.nput('bank.txt', inplace=1)
  
                      for z in l:
  
                          newLine = z.replace(rewardLine, finalLine)
                      l.close()
  
      else:
  
          await bot.send_message(message.channel, "You do not have permission to use that command!")
  </code></pre>
  
  <p>I know that it is kind of a mess, but basically people will submit their answers using !1 !2 or !3 and then an Admin will use the command !ans1correct if the answer is correct. It will then go through each of the names in the list and go through a text file called "bank.txt". It then scans each line (an example format of a line is "Joe Smith: 100 coins" (without the quotes)) and when it reaches the line it splits it by the ":" (incase any usernames contain numbers) and then regex will extract the number which is their balance. It will then add the reward of 50 coins to their balance and then replace it back into the line. It will then use fileinput to replace the old line with the new line that contains their new balance. The
      print(hello)
  and
      print(goodbye)
  are for debugging. When launched, no errors are thrown. When I use either command (!1 or !ans1correct) no errors are thrown as well. It prints the Hello but not the Goodbye so I know the code stops at the for loop. Does anyone know what is wrong with my code. I know it is a mess but I found where it messes up. It successfully appends the name of the user to the list, but for some reason when the list is accessed lower in the !ans1correct, it shows up blank. This is proven when I do print(ans1GuessList) and it just prints []. When I print it during the !1 command, it shows it successfully amended. I am quite confused on why the list empties itself before the !ans1correct. Any help is appreciated, thanks!</p>
  
  <p>EDIT: I figure that the list is only appended inside of that command, and does not affect any others. Is there anyway to append the list and have it stay outside of that command? Thanks!</p>