Answer the question
In order to leave comments, you need to log in
How to connect a bot by voice channel ID?
Good day.
There is a code:
@bot.command()
async def join(ctx):
channel = ctx.author.voice.channel
await channel.connect()
@bot.command()
async def leave(ctx):
await ctx.voice_client.disconnect()
ctx.author.voice.channel
, to register the ID of the voice channel
Answer the question
In order to leave comments, you need to log in
@bot.command()
async def join(ctx, *, voice: discord.VoiceChannel):
# https://discordpy.readthedocs.io/en/stable/ext/commands/commands.html#converters
# https://discordpy.readthedocs.io/en/stable/ext/commands/commands.html#keyword-only-arguments
await voice.connect()
@bot.command()
async def join(ctx):
await bot.get_channel(117454459249562234).connect()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question