2 # Copyright (c) 2016-2020 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
3 # notable mention: Ju <daju@fsinf.at> and @baerza
4 # published under MIT-License
8 from AbstractCommand import *
9 class CommandLernrauminfo(AbstractCommand):
10 TRIGGER = "lernrauminfo"
11 CONFIG = {"display_name": "somebot-command", "auto_complete": True,
12 "auto_complete_hint": "",
14 USEINFO = CONFIG["auto_complete_desc"] = CONFIG["description"] = "Remind of Lernraum channel / is anybody at the fsinf."
17 def on_POST(self, request, data):
18 msg = "``BOT-AUTODELETE-FAST``\nWenn du wissen willst, ob gerade jemand auf der FsInf ist, oder am Wochenende offen ist, wende dich bitte an den [(Lern) Räume](https://mattermost.fsinf.at/fsinf/channels/raeume)-Channel im [FSInf-Team](https://mattermost.fsinf.at/~invite~fsinf)."
20 "text": "Falls du dir nicht sicher bist, ob du schon im Channel bist...",
23 "name": "/join (Lern-)Räume :+1:",
24 "integration": { "url": self.URL+"/interactive", "context": { "action": "click" } }
29 request.respond(200, {"response_type":"in_channel", "text":msg, "attachments":att})
32 def on_POST_interactive(self, request, data):
33 if data["context"]["action"] == "click":
34 self.bot.api.add_user_to_channel("3qu3dyzbupgm9kodrqaijwntgc", data["user_id"])
35 request.respond(200, {"ephemeral_text": "Du solltest gejoint worden sein: https://mattermost.fsinf.at/fsinf/channels/raeume"})