I'm trying to make a discord bot using python and when I run basic code it returns "AttributeError: 'NoneType' object has no attribute 'strip'" I'm following this tutorial. I have 2 files - bot.py and bot.env(to store the token) Here are the 2 files: bot.py:
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)
and bot.env:
DISCORD_TOKEN={token}
It should display "{bot name} has connected to Discord!" I googled the error but I couldn't find a solution.