Home > database >  Why is not my discord code working? When i run the progam, it gives an error saying: TypeError: 
Why is not my discord code working? When i run the progam, it gives an error saying: TypeError: 

Time:11-12

Here is my code:

import discord
from discord.ext import commands


bot = discord.bot(command_prefix="!", help_command=None)

@bot.event
async def on_ready():
    print(f"Bot logged in as {bot.user}")
    
            
            
bot.run("TOKEN")

The error i am getting:

  File "c:\Users\user\OneDrive\Desktop\coding\discord\server bots\test.py", line 6, in <module>
    bot = discord.bot(command_prefix="!", help_command=None)
TypeError: 'module' object is not callable

I haven't coded in a while and i just got back to coding. I tried a simple discord.py program but it didn't seem to work. Is there any way i could fix this?

CodePudding user response:

The syntax is commands.Bot() with from discord.ext import commands before (which is your case). Also don't forget to specify the intents.

  • Related