title: Can't connect bot to discord
body: <p>I was learning to code a discord bot using python.
  Recently created a bot and successfully added it to my discord server.
  I installed discord.py and python-dotenv using pip.
  got the error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Users\jjjf9\AppData\Roaming\Python\Python38\site-packages\discord\http.py", line 261, in static_login
      data = await self.request(Route('GET', '/users/@me'))
    File "C:\Users\jjjf9\AppData\Roaming\Python\Python38\site-packages\discord\http.py", line 225, in request
      raise HTTPException(r, data)
  discord.errors.HTTPException: 401 UNAUTHORIZED (error code: 0): 401: Unauthorized       
  
  The above exception was the direct cause of the following exception:
  
  Traceback (most recent call last):
    File "e:/discord/bot.py", line 15, in &lt;module&gt;
      client.run(token)
    File "C:\Users\jjjf9\AppData\Roaming\Python\Python38\site-packages\discord\client.py", line 640, in run
      return future.result()
    File "C:\Users\jjjf9\AppData\Roaming\Python\Python38\site-packages\discord\client.py", line 621, in runner
      await self.start(*args, **kwargs)
    File "C:\Users\jjjf9\AppData\Roaming\Python\Python38\site-packages\discord\client.py", line 584, in start
      await self.login(*args, bot=bot)
    File "C:\Users\jjjf9\AppData\Roaming\Python\Python38\site-packages\discord\client.py", line 442, in login
      await self.http.static_login(token.strip(), bot=bot)
    File "C:\Users\jjjf9\AppData\Roaming\Python\Python38\site-packages\discord\http.py", line 265, in static_login
      raise LoginFailure('Improper token has been passed.') from exc
  discord.errors.LoginFailure: Improper token has been passed.
  Exception ignored in: &lt;function _ProactorBasePipeTransport.__del__ at 0x000001C7B373F700&gt;
  Traceback (most recent call last):
    File "C:\Program Files\Python38\lib\asyncio\proactor_events.py", line 116, in __del__ 
      self.close()
    File "C:\Program Files\Python38\lib\asyncio\proactor_events.py", line 108, in close   
      self._loop.call_soon(self._call_connection_lost, None)
    File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 715, in call_soon   
      self._check_closed()
    File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 508, in _check_closed
      raise RuntimeError('Event loop is closed')
  RuntimeError: Event loop is closed
  </code></pre>
  
  <p>the code:
  bot.py</p>
  
  <pre><code>import os
  
  import discord
  from dotenv import load_dotenv
  
  load_dotenv()
  token = os.getenv('DISCORD_TOKEN')
  
  client = discord.Client()
  
  @client.event
  async def on_ready():
      print(f'{client.user} has connected to Discord!')
  
  client.run(token)
  </code></pre>
  
  <p>.env</p>
  
  <pre><code>DISCORD_TOKEN={XXXXXXXXXXXX}
  </code></pre>