Explorar o código

Moved static files around, added inspire

Kirk Trombley %!s(int64=6) %!d(string=hai) anos
pai
achega
0c59a79193

+ 2 - 2
Dockerfile

@@ -4,8 +4,8 @@ ENV ROLLBOT_CFG_DIR /rollbot
 EXPOSE 6070
 ADD requirements.txt /rollbot
 RUN pip install -r requirements.txt
-ADD static/ /rollbot/static
-ADD templates/ /rollbot/templates
+# ADD static/ /rollbot/static
+# ADD templates/ /rollbot/templates
 ADD config/config.toml /rollbot
 ADD config/secrets.toml /rollbot
 ADD src/ /rollbot

+ 0 - 1
TODO_commands

@@ -1,6 +1,5 @@
 old:
 seychelles
-inspire
 pokemon
 shield
 say

+ 1 - 0
config/config.toml

@@ -5,6 +5,7 @@ simple = [ "info", "isadmin", "debug", "echo", "thanks", "guess", "meme", "unmem
 teamspeak = [ "teamspeak" ]
 session = [ "session" ]
 roll = [ "roll" ]
+querying = [ "inspire" ]
 
 [teamspeak]
 host = "kirkleon.ddns.net"

+ 26 - 0
src/plugins/querying.py

@@ -0,0 +1,26 @@
+import requests
+
+from command_system import RollbotResponse, RollbotFailure, as_plugin
+
+@as_plugin
+def inspire(db, message):
+    argstr = message.raw_args
+
+    if argstr is not None and "explain" in argstr:
+        return RollbotResponse(
+            message,
+            txt="Using the command !inspire will request an inspiration image from http://inspirobot.me/"
+        )
+
+    try:
+        url = requests.get("http://inspirobot.me/api?generate=true").text
+        return RollbotResponse(message, img=url)
+    except ConnectionError as e:
+        return RollbotResponse(
+            message,
+            failure_reason=RollbotFailure.SERVICE_DOWN,
+            failure_notes={
+                "explain": "Could not reach inspirobot.",
+                "exception": e
+            }
+        )

+ 0 - 0
static/rollbot.css → src/static/rollbot.css


+ 0 - 0
templates/services.html → src/templates/services.html


+ 0 - 0
templates/teamspeak.html → src/templates/teamspeak.html