Search code examples
discord.pyattributeerror

AttributeError: module 'discord' has no attribute 'Bot'


When I run my code I get this error:

 File "main.py", line 16, in <module>
   bot = discord.Bot(command_prefix = "lol");
AttributeError: module 'discord' has no attribute 'Bot'

I am not totally sure what I have to change to get it to run either. Does someone happen to know what to do?


Solution

  • If you are trying to use the commands extension, you want to put from discord.ext import commands at the top of your code. Then, change discord.Bot to commands.Bot.