diff options
author | 2025-04-15 22:37:02 +0100 | |
---|---|---|
committer | 2025-04-15 22:41:31 +0100 | |
commit | b8ff4a640acb979377cc110b5137fb422ab00965 (patch) | |
tree | 697ef90f1e6a0e038e5712604fd8fbaef3ff29ec | |
parent | Add a command to run a command on lovelace (diff) |
Add numbers command to run a tts
-rw-r--r-- | arthur/exts/fun/numbers.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/arthur/exts/fun/numbers.py b/arthur/exts/fun/numbers.py index 10f4951..90c0551 100644 --- a/arthur/exts/fun/numbers.py +++ b/arthur/exts/fun/numbers.py @@ -1,6 +1,7 @@ import discord from discord.ext import commands +from arthur.apis.netcup.ssh import rce_as_a_service from arthur.config import CONFIG @@ -59,8 +60,24 @@ class Numbers(commands.GroupCog): await ctx.message.add_reaction("🔊") @numbers.command() + async def tts(self, ctx: commands.Context, *, text: str) -> None: + """Have KA read out a message in the current VC.""" + if not ctx.guild or not ctx.guild.voice_client: + return + + if not ctx.bot.is_owner(ctx.author): + await ctx.message.add_reaction("❌") + return + + await rce_as_a_service( + f"echo '{text}' > /opt/messages/tts_message.txt && " + "touch -a -m -t 197501010001 /opt/messages/tts_message.txt && " + "sudo /opt/numbers-code-generator.sh" + ) + + @numbers.command() async def stop(self, ctx: commands.Context) -> None: - """Stop playing URN in the servers voice channel.""" + """Stop relaying numbers in the voice channel.""" if ctx.guild and (vc := ctx.guild.voice_client): await vc.disconnect(force=True) await ctx.message.add_reaction("🔇") |