aboutsummaryrefslogtreecommitdiffstats
path: root/slack/commands.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-01-29 21:15:15 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:53 +0100
commitc643c84a253b3e98f5e0a1fc19855e948c84fc99 (patch)
tree9e593d86833a7aa3a831cdf74eb2e4e152214d32 /slack/commands.py
parenta91e003fcdb63e80172b2c001597f4042179d04e (diff)
downloadwee-slack-c643c84a253b3e98f5e0a1fc19855e948c84fc99.tar.gz
Add command /slack disconnect
Diffstat (limited to 'slack/commands.py')
-rw-r--r--slack/commands.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/slack/commands.py b/slack/commands.py
index bcdeb69..cd25456 100644
--- a/slack/commands.py
+++ b/slack/commands.py
@@ -130,6 +130,21 @@ def command_slack_connect(
create_task(connect())
+@weechat_command("%(slack_workspaces)|-all")
+def command_slack_disconnect(
+ buffer: str, args: List[str], options: Dict[str, Optional[str]]
+):
+ if args and args[0]:
+ workspace = shared.workspaces.get(args[0])
+ if workspace:
+ workspace.disconnect()
+ else:
+ print_error(f'workspace "{args[0]}" not found')
+ elif options.get("all", False) is None:
+ for workspace in shared.workspaces.values():
+ workspace.disconnect()
+
+
@weechat_command()
def command_slack_workspace(
buffer: str, args: List[str], options: Dict[str, Optional[str]]