From fbee81d9dcd71bea582d5d3456672b9b198fa3ad Mon Sep 17 00:00:00 2001 From: Someone Date: Fri, 19 Jun 2020 01:32:13 +0200 Subject: [PATCH] [somebot] /join-all --- somebot/modules/CommandJoinAll.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 somebot/modules/CommandJoinAll.py diff --git a/somebot/modules/CommandJoinAll.py b/somebot/modules/CommandJoinAll.py new file mode 100644 index 0000000..435366c --- /dev/null +++ b/somebot/modules/CommandJoinAll.py @@ -0,0 +1,22 @@ +# Mattermost Bot. +# Copyright (c) 2016-2020 by Someone (aka. Jan Vales ) +# Copyright (c) 2020 by lavish ("Typos" fixed) +# published under MIT-License + + + +from AbstractCommand import * +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 on_POST(self, request, data): + msg = "" + for c in self.bot.api.get_team_channels(self.TEAM_ID): + 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)) + -- 2.43.0