Вам просто нужно создать новую функцию, которая будет воспроизводиться, когда звук закончится, например, repeat
:
@client.command()
async def play(ctx):
await ctx.channel.purge(limit=1)
channel = ctx.author.voice.channel
voice = get(self.bot.voice_clients, guild=ctx.guild)
def repeat(ctx):
voice = get(self.bot.voice_clients, guild=ctx.guild)
voice.play(discord.FFmpegPCMAudio('audio.mp3', after=lambda e: repeat(ctx))
voice.is_playing()
if channel and not voice.is_playing():
voice.play(discord.FFmpegPCMAudio('audio.mp3', after=lambda e: repeat(ctx))
voice.is_playing()