Answers for "discord bot sound channel python"

8

python discord bot join voice channel

@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()
Posted by: Guest on June-08-2020
2

discord.py play mp3 file

@bot.command(aliases=['paly', 'queue', 'que'])
async def play(ctx):
    guild = ctx.guild
    voice_client: discord.VoiceClient = discord.utils.get(bot.voice_clients, guild=guild)
    audio_source = discord.FFmpegPCMAudio('vuvuzela.mp3')
    if not voice_client.is_playing():
        voice_client.play(audio_source, after=None)
Posted by: Guest on September-21-2020

Code answers related to "discord bot sound channel python"

Python Answers by Framework

Browse Popular Code Answers by Language