I am trying to code a discord music bot and came with this problem

78 Views Asked by At

my problem are the packages are the tags one

enter image description here

the main.py code

from discord.ext import commands
import music

cogs = [music]

client = commands.Bot(command_prefix='sus!', intents = discord.Intents.all())

for i in range(len(cogs)):
    cogs[i].setup(client)


client.run("The discord bot id")```


2

There are 2 best solutions below

0
On

So error seems to be ur syntax error in ur music.py line 2 make from discord.ext import commands

If it works , pls make this answer as accepted answer

0
On

So it seems you forgot to import discord... do
import discord from discord.ext import commands

this is definetly gonna fix your problem but remember you can't take something from something that you haven't imported. Just like you can't take something from discord.ext if you haven't imported discord since discord.ext is extension and you haven't even imported discord.