Skip to content

Commit b8ff4a6

Browse files
committed
Add numbers command to run a tts
1 parent 19b6dc8 commit b8ff4a6

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

arthur/exts/fun/numbers.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import discord
22
from discord.ext import commands
33

4+
from arthur.apis.netcup.ssh import rce_as_a_service
45
from arthur.config import CONFIG
56

67

@@ -58,9 +59,25 @@ async def numbers(
5859
vc.play(discord.FFmpegOpusAudio(CONFIG.numbers_url))
5960
await ctx.message.add_reaction("🔊")
6061

62+
@numbers.command()
63+
async def tts(self, ctx: commands.Context, *, text: str) -> None:
64+
"""Have KA read out a message in the current VC."""
65+
if not ctx.guild or not ctx.guild.voice_client:
66+
return
67+
68+
if not ctx.bot.is_owner(ctx.author):
69+
await ctx.message.add_reaction("❌")
70+
return
71+
72+
await rce_as_a_service(
73+
f"echo '{text}' > /opt/messages/tts_message.txt && "
74+
"touch -a -m -t 197501010001 /opt/messages/tts_message.txt && "
75+
"sudo /opt/numbers-code-generator.sh"
76+
)
77+
6178
@numbers.command()
6279
async def stop(self, ctx: commands.Context) -> None:
63-
"""Stop playing URN in the servers voice channel."""
80+
"""Stop relaying numbers in the voice channel."""
6481
if ctx.guild and (vc := ctx.guild.voice_client):
6582
await vc.disconnect(force=True)
6683
await ctx.message.add_reaction("🔇")

0 commit comments

Comments
 (0)