|
@@ -0,0 +1,24 @@
|
|
|
+import tempfile
|
|
|
+import os.path
|
|
|
+
|
|
|
+from gtts import gTTS
|
|
|
+import requests
|
|
|
+
|
|
|
+from command_system import as_plugin
|
|
|
+from config import get_secret
|
|
|
+
|
|
|
+YELL_ENDPOINT = get_secret("yell.endpoint")
|
|
|
+
|
|
|
+
|
|
|
+@as_plugin
|
|
|
+def yell(msg):
|
|
|
+ tmp_dir = tempfile.mkdtemp()
|
|
|
+ tmp_file = os.path.join(tmp_dir, "yell.mp3")
|
|
|
+
|
|
|
+ tts = gTTS(text=msg.raw_args, lang="en", slow=False)
|
|
|
+ tts.save(tmp_file)
|
|
|
+
|
|
|
+ with open(tmp_file, "rb") as f:
|
|
|
+ requests.post(YELL_ENDPOINT, data=f)
|
|
|
+
|
|
|
+ return "Passed the message along to Audiobot!"
|