From 106789319b1de06e9e8206c3a8d1dedab84496a1 Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 23 Mar 2026 17:43:09 +0100 Subject: unify settings api into one file --- cogs/tts.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'cogs/tts.py') diff --git a/cogs/tts.py b/cogs/tts.py index 46ab637..5e6945c 100644 --- a/cogs/tts.py +++ b/cogs/tts.py @@ -6,12 +6,12 @@ import os import json import discord -import aiofiles import logging import tempfile from discord.ext import commands from gtts import gTTS import asyncio +from cogs.utils.settings import get_volume logger = logging.getLogger(__name__) @@ -19,18 +19,6 @@ class TTS(commands.Cog): def __init__(self, bot): self.bot = bot - async def _load_settings(self): - """Load volume settings from settings.json""" - volume = 1.0 - try: - async with aiofiles.open('settings.json') as f: - content = await f.read() - data = json.loads(content) - volume = data.get('volume', 1.0) - except (json.JSONDecodeError, KeyError, FileNotFoundError) as e: - logger.error(f"Error loading settings: {e}") - return volume - async def _handle_file_output(self, ctx, temp_path, text): """Handle TTS file output""" try: @@ -109,7 +97,7 @@ class TTS(commands.Cog): tts.save(temp_path) # Load settings - volume = await self._load_settings() + volume = get_volume() # Handle output based on user choice if output == "file": -- cgit v1.2.3