--- /dev/null
+# Mattermost Bot module.
+# Copyright (c) 2016-2021 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
+# Copyright (c) 2020 by lavish <marco.squarcina@tuwien.ac.at> ("Typos" fixed)
+# published under MIT-License
+
+
+
+from AbstractCommand import AbstractCommand
+class CommandJoinAll(AbstractCommand):
+ TRIGGER = "join-all"
+ CONFIG = {"display_name": "somebot-command", "auto_complete": True}
+ USEINFO = CONFIG["auto_complete_desc"] = CONFIG["description"] = "Join all public channels in this team. There is no undo."
+
+
+ def __init__(self, team_id, skip_chann_ids):
+ super().__init__(team_id)
+
+ self.skip_chann_ids = skip_chann_ids
+
+
+ def on_POST(self, request, data):
+ msg = ""
+ for c in self.bot.api.get_team_channels(self.TEAM_ID):
+ if not c["id"] in self.skip_chann_ids:
+ self.bot.api.add_user_to_channel(c["id"], data["user_id"])
+ msg += "\n + ~"+c["name"]
+
+ request.cmd_respond_text_temp("### ``Done`` :)\nYou joined all the public channels in the team:\n{}\nA reload might be needed to display the updated list of channels".format(msg))