aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/tts.py
diff options
context:
space:
mode:
Diffstat (limited to 'cogs/tts.py')
-rw-r--r--cogs/tts.py16
1 files changed, 2 insertions, 14 deletions
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 @@
6import os 6import os
7import json 7import json
8import discord 8import discord
9import aiofiles
10import logging 9import logging
11import tempfile 10import tempfile
12from discord.ext import commands 11from discord.ext import commands
13from gtts import gTTS 12from gtts import gTTS
14import asyncio 13import asyncio
14from cogs.utils.settings import get_volume
15 15
16logger = logging.getLogger(__name__) 16logger = logging.getLogger(__name__)
17 17
@@ -19,18 +19,6 @@ class TTS(commands.Cog):
19 def __init__(self, bot): 19 def __init__(self, bot):
20 self.bot = bot 20 self.bot = bot
21 21
22 async def _load_settings(self):
23 """Load volume settings from settings.json"""
24 volume = 1.0
25 try:
26 async with aiofiles.open('settings.json') as f:
27 content = await f.read()
28 data = json.loads(content)
29 volume = data.get('volume', 1.0)
30 except (json.JSONDecodeError, KeyError, FileNotFoundError) as e:
31 logger.error(f"Error loading settings: {e}")
32 return volume
33
34 async def _handle_file_output(self, ctx, temp_path, text): 22 async def _handle_file_output(self, ctx, temp_path, text):
35 """Handle TTS file output""" 23 """Handle TTS file output"""
36 try: 24 try:
@@ -109,7 +97,7 @@ class TTS(commands.Cog):
109 tts.save(temp_path) 97 tts.save(temp_path)
110 98
111 # Load settings 99 # Load settings
112 volume = await self._load_settings() 100 volume = get_volume()
113 101
114 # Handle output based on user choice 102 # Handle output based on user choice
115 if output == "file": 103 if output == "file":