title: How to loop in Discord.py?
body: <p>I've tried to make the loop function but the bot ignores commands from the user as well as I searched all over the internet how to fix it but I still haven't got any answers. Here is my code:</p>
  <pre><code>from discord.ext import tasks, commands
  import discord
  import json
  import requests
  
  # My function
  @tasks.loop(seconds=10)
  async def covloop():
    while True:
      time.sleep(10)
      cov = requests.get(&quot;https://covid19.th-stat.com/api/open/today&quot;)
      covdate = json.loads(cov.text)['UpdateDate']
      cf = json.loads(cov.text)['NewConfirmed']
      with open(&quot;data.json&quot;, 'r+') as file:
        data = json.load(file)
        updateTime = data['date']
        print(updateTime)
        if updateTime == covdate:
          pass
        elif updateTime != covdate:
          await bot.get_channel(827873382263029770).send('New confirmed: {}'.format(cf))
          data['date'] = covdate
          file.seek(0)
          json.dump(data,file)
          file.truncate()
    print(str(covdate))
  
  bot = commands.Bot(command_prefix=[&quot;$&quot;],case_insensitive=True)
  
  @bot.event
  async def on_ready():
    print(&quot;We've logged in as {0.user}&quot;.format(bot))
    covloop.start()
  </code></pre>