]> git.somenet.org - pub/jan/mattermost-bot.git/blob - modules/CommandThreads.py
modules/CommandThreads.py
[pub/jan/mattermost-bot.git] / modules / CommandThreads.py
1 # Mattermost Bot module.
2 #  Copyright (c) 2016-2022 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 # pylint: disable=wrong-import-position
9 from AbstractCommand import AbstractCommand
10 class CommandThreads(AbstractCommand):
11     TRIGGER = "threads"
12     CONFIG = {"display_name": "somebot-command", "auto_complete": True,
13               "auto_complete_hint": "['oida'|'oidaaa'|'oida minusf'|'oida?']",
14              }
15     CONFIG["auto_complete_desc"] = CONFIG["description"] = AbstractCommand.ICON_PUBLIC+"Remind of thread usage."
16     USEINFO = cleandoc("""
17         Use ``/threads`` optionally with one of the following arguments ``'oida'|'oidaaa'|'oida minusf'|'oida?'`` to remind a person to use threads.
18         """)
19
20
21     def on_POST(self, request, data):
22         msg = "Bitte verwende Threads, um die Kommunikation übersichtlicher zu gestalten.\nThread-view öffnen mit: shift+up, oder dem kleinen Pfeil."
23
24         if data["text"] == "":
25             pass
26
27         elif data["text"] == "oida":
28             msg = "***"+msg.upper()+"***"
29
30         elif data["text"] == "oidaaa":
31             msg = cleandoc("""
32                 ## :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:
33                 ## :point_right: BITTE VERWENDE ``THREADS``, UM DIE KOMMUNIKATION ÜBERSICHTLICHER ZU GESTALTEN.
34                 ## :point_right: THREAD-VIEW ÖFFNEN MIT: SHIFT+UP, ODER DEM KLEINEN PFEIL.
35                 ## :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:
36                 """)
37
38         elif data["text"] == "oida?":
39             msg = "``/threads`` ... oida?\n-> https://www.youtube.com/watch?v=iuXR53ex4iI"
40
41         elif data["text"] == "oida minusf":
42             msg = cleandoc("""
43                 ## :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:
44                 ## :point_right: ``OIDA! THREADS OIDA!``
45                 ## :point_right: ``OIDA, OIDA, THREAD-VIEW OIDA, OIDA.``
46                 ## :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:
47                 """)
48
49         else:
50             request.respond_cmd_err("``/"+self.TRIGGER+"`` needs either no parameter or 'oida', 'oidaaa', 'oida minusf', 'oida?' :)")
51             return
52
53         request.respond_cmd_chan(msg)