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
5 from inspect import cleandoc
8 from AbstractCommand import AbstractCommand
9 class CommandBeratungsinfo(AbstractCommand):
10 TRIGGER = "beratungsinfo"
11 CONFIG = {"display_name": "somebot-command", "auto_complete": True,
12 "auto_complete_hint": "",
14 USEINFO = CONFIG["auto_complete_desc"] = CONFIG["description"] = "Where to get help."
17 def on_POST(self, request, data):
18 msg = cleandoc("""``AUTODELETE-DAY``
19 Fragen zum Studium oder anderer Uni-Themen werden im [Beratungschannel](https://mattermost.fsinf.at/fsinf/channels/beratung) im [Community-Team](https://mattermost.fsinf.at/~invite~fsinf) beantwortet.\n
20 Questions regarding the curriculum or other university-related topics are answered in the [Beratungschannel](https://mattermost.fsinf.at/fsinf/channels/beratung) in the [Community-Team](https://mattermost.fsinf.at/~invite~fsinf)
24 "text": "Falls du dir nicht sicher bist, ob du schon im Channel bist...\n\nIf you are unsure whether you are in the Beratungschannel...",
26 "name": "/join Beratungchannel :+1:",
27 "integration": {"url": self.URL+"/interactive", "context": {"action": "click"}}
31 request.respond(200, {"response_type":"in_channel", "text":msg, "attachments":att})
34 def on_POST_interactive(self, request, data):
35 if data["context"]["action"] == "click":
36 self.bot.api.add_user_to_channel("3qu3dyzbupgm9kodrqaijwntgc", data["user_id"])
37 request.respond(200, {"ephemeral_text": "Du solltest gejoint worden sein: https://mattermost.fsinf.at/fsinf/channels/beratung\n\nYou should have been joined into: https://mattermost.fsinf.at/fsinf/channels/beratung"})