title: Discord Bot Crashing with no errors
body: <p>The issue I am having is that this code will work for four to five minutes, if the text file updates, the message will be displayed on discord. But what happens is that either it runs out of memory or some other issue arises and the bot just stops and will no longer pick up messages.</p>
  
  <p>the text file is getting inputs from a source and added to at random times. It also does not leave any error message.</p>
  
  <pre><code>    import discord
      import asyncio
      from discord.ext import commands
      import time
  
  
      global count
  
      bot = commands.Bot(command_prefix="!")
  
      def get_msg(): #Retrieves the last message from the text file
          global last
          global logs
          logs = open('msg.txt','r')
          msgs = logs.readlines()
          logs.close()
          last = msgs[len(msgs)-1]
  
      def line_count(): #Retrieves the amount of lines in the text file
          global count
          r = open("msg.txt", 'r')
          j = r.readlines()
          r.close()
          count = 0
  
          for line in j:
  
              count += 1
          r.close()
          return count
  
      async def run(): #checks if the amount of lines has changed, if it has; displays message
          global count
  
          ct = line_count()
          oc = ct
          await bot.wait_until_ready()
  
          while True:
  
              if ct != oc:
                  oc = ct
                  get_msg()
                  prep = "Incoming: " + last
                  await bot.send_message(discord.Object('******'),prep)
  
                  oc = ct
              else:
                  ct = line_count()
  
  
  
  
      bot.loop.create_task(run())        
      bot.run('***********')
  </code></pre>