I need help in your discord bot tutorial i get this error

Traceback (most recent call last):
  File "main.py", line 19, in <module>
    client.run(os.getenv('TOKEN'))
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 723, in run
    return future.result()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 702, in runner
    await self.start(*args, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 665, in start
    await self.login(*args, bot=bot)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 511, in login
    await self.http.static_login(token.strip(), bot=bot)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/http.py", line 304, in static_login
    raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.
 

I have not even refreshed the token
if I refresh token then I’ve also putted it in .env file pls help the code that I type

import discord
import os


client = discord.Client()

@client.event
async def on_ready():
  print('we have logged in as {0.user}'.format(client))

@client.event
async def on_messages(message):
    if message.author == client.user:
      return

      if message.content.startswith('!hi'):
        await message.channel.send('hello im dogge bot nice to meet you :D')

client.run(os.getenv('TOKEN'))

If there is any problem in code then help me out I’m gonna make a advance bot so iam testing

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Have you tried restarting your terminal/environment?
Sometimes the env doesn’t get updated.
Moreover, did you by accident post your token on github or discord?
(If that happens, discord resets your token)