From b57451b40231324eced1ee7f957cfb84b2ae8f4a Mon Sep 17 00:00:00 2001 From: whats2000 <60466660+whats2000@users.noreply.github.com> Date: Sat, 26 Oct 2024 23:38:01 +0800 Subject: [PATCH] Update play_tts.py --- bot/message_command/play_tts.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bot/message_command/play_tts.py b/bot/message_command/play_tts.py index b453fc0..4decd2a 100644 --- a/bot/message_command/play_tts.py +++ b/bot/message_command/play_tts.py @@ -5,6 +5,7 @@ from disnake.ext import commands from bot.api.tts_handler import text_to_speech from bot import user_settings +from bot.utils.extract_user_nickname import extract_user_nickname from config import GUILD_ID from utils.logger import logger @@ -60,7 +61,8 @@ async def play_tts(self, inter: disnake.ApplicationCommandInteraction, message: for attempt in range(1, self.max_retries + 1): try: logger.info(f"Fetching TTS audio (attempt {attempt})...") - text = f"{inter.author.display_name} 說: {message.content}" + player_name = extract_user_nickname(inter.author.display_name) + text = f"{player_name} 說: {message.content}" audio_data = text_to_speech(text, character_name, message) logger.info("Audio data fetched successfully") logger.info(f"Audio data length: {len(audio_data)} bytes")