Fix quote tts

This commit is contained in:
2021-10-07 12:58:08 +02:00
parent c2155376eb
commit f7598cf0a9
2 changed files with 8 additions and 8 deletions

9
bot.py
View File

@@ -795,11 +795,12 @@ async def quote_random_slash(ctx: SlashContext, author: Optional[str] = None, tt
if tts:
voice: discord.VoiceState = ctx.author.voice
if voice.channel is not None:
async def after_play(e: discord.DiscordException, vp: discord.VoiceProtocol):
await vp.disconnect(force=True)
source, tts_destroyer = text_to_speech(author + " sagte: " + quote)
vp: discord.VoiceClient = await connect_and_play(voice.channel, source)
while vp.is_playing() and vp.channel == voice.channel:
await asyncio.sleep(0.5)
source, tts_destroyer = text_to_speech(quote)
await connect_and_play(voice.channel, source, after_play=after_play)
await vp.disconnect()
tts_destroyer()