mirror of
https://github.com/System-End/tts.git
synced 2026-04-19 14:17:05 +00:00
why
This commit is contained in:
parent
80ba304043
commit
026d0d94ea
1 changed files with 7 additions and 6 deletions
13
bot.py
13
bot.py
|
|
@ -26,7 +26,6 @@ with open("config.json", "r", encoding="utf-8") as f:
|
|||
with open("voices.json", "r", encoding="utf-8") as f:
|
||||
voices_data = json.load(f)
|
||||
|
||||
data directory (set this in your deployment environment, e.g. Coolify)
|
||||
DATA_DIR = os.getenv("DATA_DIR", "/app/data")
|
||||
Path(DATA_DIR).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
|
@ -181,8 +180,7 @@ async def enqueue(
|
|||
guild: discord.Guild, member: discord.Member, text: str, voice_id: str
|
||||
):
|
||||
q = tts_queues.setdefault(guild.id, asyncio.Queue())
|
||||
await q.put((text
|
||||
, voice_id, member))
|
||||
await q.put((text, voice_id, member))
|
||||
if q.qsize() == 1:
|
||||
asyncio.create_task(queue_worker(guild))
|
||||
|
||||
|
|
@ -233,7 +231,9 @@ async def queue_worker(guild: discord.Guild):
|
|||
except Exception as e:
|
||||
logger.error(f"Playback error: {e}")
|
||||
try:
|
||||
await member.send("Failed to play audio. Check that ffmpeg is installed.")
|
||||
await member.send(
|
||||
"Failed to play audio. Check that ffmpeg is installed."
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
|
@ -271,7 +271,9 @@ async def on_message(message: discord.Message):
|
|||
|
||||
if not message.author.voice or not message.author.voice.channel:
|
||||
try:
|
||||
await message.reply("You need to be in a voice channel.", mention_author=False)
|
||||
await message.reply(
|
||||
"You need to be in a voice channel.", mention_author=False
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
return
|
||||
|
|
@ -521,7 +523,6 @@ async def tts_enable(interaction: discord.Interaction):
|
|||
)
|
||||
return
|
||||
|
||||
|
||||
enabled = tts_enabled.setdefault(interaction.guild_id, set())
|
||||
if interaction.user.id in enabled:
|
||||
await interaction.response.send_message(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue