@client.tree.command(name = "join", description = "Makes the bot join your voice channel.")
async def join(interaction: discord.VoiceChannel):
try:
if interaction.guild.voice_client:
channel = interaction.guild.voice_client.channel
await channel.connect()
await interaction.response.send_message(content = "I joined the voice channel!")
elif not interaction.message.author.voice:
await interaction.response.send_message(content = "You have to join a voice channel to use this command!")
except:
await interaction.response.send_message(content = "I'm already in the voice channel, are you blind?")
I tried to find a youtube tutorial of how to make your discord bot join your voice channel using slash command but I couldn’t find any.
New contributor
Eidan T. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.