]> git.somenet.org - pub/jan/mattermost-bot.git/blob - modules/CommandThreads.py
core/AbstractCommand.py
[pub/jan/mattermost-bot.git] / modules / CommandThreads.py
1 # Mattermost Bot module.
2 #  Copyright (c) 2016-2021 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
3 #  published under MIT-License
4
5 from inspect import cleandoc
6
7
8 from AbstractCommand import AbstractCommand
9 class CommandThreads(AbstractCommand):
10     TRIGGER = "threads"
11     CONFIG = {"display_name": "somebot-command", "auto_complete": True,
12               "auto_complete_hint": "['oida'|'oidaaa'|'oida minusf'|'oida?']",
13              }
14     CONFIG["auto_complete_desc"] = CONFIG["description"] = "Remind of thread usage."
15     USEINFO = cleandoc("""
16         Use ``/threads`` optionally with one of the following arguments ``'oida'|'oidaaa'|'oida minusf'|'oida?'`` to remind a person to use threads.
17         """)
18
19
20     def on_POST(self, request, data):
21         msg = "Bitte verwende Threads, um die Kommunikation übersichtlicher zu gestalten.\nThread-view öffnen mit: shift+up, oder dem kleinen Pfeil."
22
23         if data["text"] == "":
24             pass
25
26         elif data["text"] == "oida":
27             msg = "***"+msg.upper()+"***"
28
29         elif data["text"] == "oidaaa":
30             msg = cleandoc("""
31                 ## :warning::point_down::point_down::point_down::point_down::point_down::point_down::point_down::point_down::point_down::point_down::point_down::point_down::point_down::point_down:
32                 ## :point_right: BITTE VERWENDE ``THREADS``, UM DIE KOMMUNIKATION ÜBERSICHTLICHER ZU GESTALTEN.
33                 ## :point_right: THREAD-VIEW ÖFFNEN MIT: SHIFT+UP, ODER DEM KLEINEN PFEIL.
34                 ## :warning::point_up::point_up_2::point_up::point_up_2::point_up::point_up_2::point_up::point_up_2::point_up::point_up_2::point_up::point_up_2::point_up::point_up_2:
35                 """)
36
37         elif data["text"] == "oida?":
38             msg = "``/threads`` ... oida?\n-> https://www.youtube.com/watch?v=iuXR53ex4iI"
39
40         elif data["text"] == "oida minusf":
41             msg = cleandoc("""
42                 ## :warning::point_down::point_down::point_down::point_down::point_down::point_down::point_down::point_down::point_down::point_down::point_down::point_down::point_down:
43                 ## :point_right: ``OIDA! THREADS OIDA!``
44                 ## :point_right: ``OIDA, OIDA, THREAD-VIEW OIDA, OIDA.``
45                 ## :warning::point_up::point_up_2::point_up::point_up_2::point_up::point_up_2::point_up::point_up_2::point_up::point_up_2::point_up::point_up_2::point_up:
46                 """)
47
48         else:
49             request.cmd_respond_text_temp("Die zulässigen Parameter sind: nichts, 'oida', 'oidaaa', 'oida minusf'. :)")
50             return
51
52         request.cmd_respond_text_chan(msg)