📜  discord.py 播放 mp3 文件 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:24.227000             🧑  作者: Mango

代码示例1
@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)