Skip to content

Commit

Permalink
Update play_tts.py
Browse files Browse the repository at this point in the history
  • Loading branch information
whats2000 committed Oct 26, 2024
1 parent 7e14963 commit b57451b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bot/message_command/play_tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit b57451b

Please sign in to comment.