Search code examples
pythonpython-3.xdiscordbotsnextcord

ImportError: cannot import name 'Enum' from 'discord' (unknown location)


How to fix? | Python


import nextcord
from nextcord.ext import commands
import wavelink

class Music(commands.Cog):

    def __init__(self, bot: commands.Bot):
        self.bot = bot

        bot.loop.create_task(self.connect_nodes())

    async def connect_nodes(self):
        await self.bot.wait_until_ready()
        await wavelink.NodePool.create_node(bot=self.bot, host='0.0.0.0', port=2333, password='yousheldnotpass')

    @commands.Cog.listener
    async def on_wavelink_node_ready(self, node: wavelink.Node):
        print(f'Node [{node.identifier}] - ✅')

    @commands.command()
    async def play(self, ctx: commands.Context, *, search: wavelink.YouTubeTrack):
        if not ctx.voice_client:
            vc: wavelink.Player = await ctx.author.voice.channel.connect(cls=wavelink.Player)
        else:
            vc: wavelink.Player = ctx.voice_client
        await vc.play(search)



def setup(bot):
    bot.add_cog(Music(bot))

I tried writing different variations of the code, everything gave out exactly 1 error, but I did not find an answer in Internet resources.


Solution

  • The problem is wavelink needs discord.py to run and you are using nextcord , so with nextcord you can use nextwave