testmusic.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:nyx 作者: Cappycot 项目源码 文件源码
def play_file(self, ctx, *, query):
        """Plays a file from the local filesystem"""

        if ctx.voice_client is None:
            if ctx.author.voice.channel:
                await ctx.author.voice.channel.connect()
            else:
                return await ctx.send("Not connected to a voice channel.")

        if ctx.voice_client.is_playing():
            ctx.voice_client.stop()

        source = discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(query))
        ctx.voice_client.play(source, after=lambda e: print(
            'Player error: %s' % e) if e else None)

        await ctx.send('Now playing: {}'.format(query))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号