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 # pylint: disable=wrong-import-position
9 from AbstractCommand import AbstractCommand
10 class CommandBeratungsinfo(AbstractCommand):
11 TRIGGER = "beratungsinfo"
12 CONFIG = {"display_name": "somebot-command", "auto_complete": True,
13 "auto_complete_hint": "",
15 USEINFO = CONFIG["auto_complete_desc"] = CONFIG["description"] = AbstractCommand.ICON_PUBLIC+"Where to get help."
18 def on_POST(self, request, data):
19 msg = cleandoc("""``AUTODELETE-DAY``
20 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
21 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)
25 "text": "Falls du dir nicht sicher bist, ob du schon im Channel bist...\n\nIf you are unsure whether you are in the Beratungschannel...",
27 "name": "/join Beratungchannel :+1:",
28 "integration": {"url": self.URL+"/interactive", "context": {"action": "click"}}
32 request.respond_interactive_chan(msg, att=att)
35 def on_POST_interactive(self, request, data):
36 if data["context"]["action"] == "click":
37 self.bot.api.add_user_to_channel("3qu3dyzbupgm9kodrqaijwntgc", data["user_id"])
38 request.respond_interactive_temp("## :white_check_mark: Success! :)\n### 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")