D
D
Daniel Lebedinsky2020-05-26 01:00:05
Python
Daniel Lebedinsky, 2020-05-26 01:00:05

How to connect a bot to the MC in discord?

Shalom
I'm trying to write a function to join a bot in a Discord voice chat, but I'm getting an error...
I can't figure out what the problem is.

@bot.command()
async def join(ctx):
    global voice

    channel = ctx.message.author.voice.channel
    voice = get(bot.voice_clients, guild=ctx.guild)

    if voice and voice.is_connected():
        await voice.move_to(channel)
    else:
        voice = await connect.channel()
        await ctx.send(f'Бот присоеденился к каналу: {channel}')


Mistake:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: type object 'Connect' has no attribute 'channel'

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question