[somebot] /toss <search term>
authorSomeone <someone@somenet.org>
Wed, 8 Dec 2021 18:38:38 +0000 (19:38 +0100)
committerSomeone <someone@somenet.org>
Wed, 8 Dec 2021 18:38:38 +0000 (19:38 +0100)
modules/CommandToss.py [new file with mode: 0644]

diff --git a/modules/CommandToss.py b/modules/CommandToss.py
new file mode 100644 (file)
index 0000000..5f5d73b
--- /dev/null
@@ -0,0 +1,19 @@
+# Mattermost Bot module.
+#  Copyright (c) 2016-2021 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
+#  published under MIT-License
+
+import requests
+
+
+from AbstractCommand import AbstractCommand
+class CommandToss(AbstractCommand):
+    TRIGGER = "toss"
+    CONFIG = {"display_name": "somebot-command", "auto_complete": True,
+              "auto_complete_hint": "<any search term>",
+             }
+    USEINFO = CONFIG["auto_complete_desc"] = CONFIG["description"] = "Use TOSS."
+
+
+    def on_POST(self, request, data):
+        msg = "#### Let me :toss: that for you :)\n:arrow_right: https://toss.fsinf.at/?q="+requests.utils.quote(data["text"])
+        request.cmd_respond_text_chan(msg)