title: Python discord bot - coroutine was never awaited
body: <p>I'm working on a Discord bot and it works to some degree but it keeps crashing every couple minutes. It gives me an error like</p>
  <blockquote>
  <p>Task was detroyed but it's pending</p>
  </blockquote>
  <p>I came across the information that I had to get rid of my <code>response = request.get(url)</code> and replace it with <code>async with aiohttp.get(url) as response</code>.</p>
  <p>Now when I have it like this, it gives me</p>
  <blockquote>
  <p>coroutine 'availability' was never awaited&quot;</p>
  </blockquote>
  <p>To solve this I think I have to use some sort of loop, but how exactly do I need to do this?</p>
  <pre><code>import discord
  from discord.ext.commands import Bot
  from discord.ext import commands
  import asyncio
  import time
  
  import requests
  from bs4 import BeautifulSoup
  import smtplib
  import aiohttp
  import async_timeout
  
  async def availability():
      url = &quot;some url&quot;
      headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
      async with aiohttp.ClientSession().get(url, headers=headers) as response:
          soup = BeautifulSoup(response.text, &quot;lxml&quot;)
          print(soup)
          return soup
  
  Client = discord.Client()
  bot_prefix= &quot;?&quot;
  client = commands.Bot(command_prefix=bot_prefix)
  
  availible = True
  
  @client.event
  async def on_ready():
      print(&quot;Bot Online!&quot;)
      print(&quot;Name: {}&quot;.format(client.user.name))
      print(&quot;ID: {}&quot;.format(client.user.id))
  
      bessie = 0
      waittime = 0
  
      while True:
          time.sleep(1)
          if wachttijd == 0:
              if (&quot;0 available&quot;) not in str(availability()):
                  bessie = bessie + 1
                  if bessie == 3:
                      await client.send_message(discord.Object(id='some id'),
                                                '&lt;@&amp;some channel&gt;some text!')
                      print(&quot;available&quot;)
                      bessie = 0
                      waittime = 10
              else:
                  bessie = 0
          else:
              wachttijd = wachttijd - 1
  
  client.run(&quot;token&quot;)
  </code></pre>