feat(tts): bunch of changes
All checks were successful
Actions / Lint Code (Ruff) (pull_request) Successful in 15s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 27s

- changed how the cog loads, instead of depending on the `PyLavPlayer` cog, it'll just load PyLav from the `__init__.py` file
- moved configuration to a separate file
- added a configuration menu
- added pylav as a dependency in poetry and `info.json`
- set repository python version to `>=3.11,<3.12`
This commit is contained in:
SeaswimmerTheFsh 2024-02-21 10:53:28 -05:00
parent bcca864d02
commit 3c4fba46b6
Signed by: cswimr
GPG key ID: B8953EC01E5C4063
7 changed files with 1275 additions and 51 deletions

View file

@ -8,9 +8,12 @@
import logging
from discord import Message
from redbot.core import Config, commands
from redbot.core import commands
from redbot.core.bot import Red
from tts.config import config
from tts.menu import Menu
class TTS(commands.Cog):
"""Text to Speech through Pylav"""
@ -18,15 +21,6 @@ class TTS(commands.Cog):
def __init__(self, bot: Red):
self.bot = bot
self.logger = logging.getLogger("red.sea.tts")
self.config = Config.get_conf(self, 69737245070283, force_registration=True)
self.config.register_global(
use_google_tts = False,
)
self.config.register_guild(
enabled_channels = [],
announce = False,
voice_channels = True
)
async def on_message(self, message: Message):
await self.bot.wait_until_red_ready()
@ -47,4 +41,17 @@ class TTS(commands.Cog):
#TODO - add PyLav integration
return
#TODO - add commands for enabling/disabling channels, setting voice channel settings, and setting global settings
@commands.group(name="tts", autohelp=True)
@commands.admin_or_permissions(manage_guild=True)
async def tts(self, ctx: commands.Context):
"""Text to Speech settings"""
await ctx.send(view=Menu(ctx))
@tts.command(name="google")
@commands.is_owner()
async def tts_google(self, ctx: commands.Context, enable: bool = None):
"""Enable or disable Google Cloud TTS"""
if enable is None:
enable = not await config.use_google_tts()
await config.use_google_tts.set(enable)
await ctx.send(f"Google TTS has been {'enabled' if enable else 'disabled'}.")