play mp3 in vc discord.py code example
Example 1: 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)
Example 2: python pygame play mp3
import pygame
pygame.mixer.init()
pygame.mixer.music.load('your_music_name.mp3')
pygame.mixer.music.play()
input('Insert something to end the player')