aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2024-03-10 14:01:36 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-03-29 00:00:15 +0100
commit5d8275080e3d325541b2a22c38356113ddaab027 (patch)
tree175bda4182448ecc66ceb3f5832170de09395e73
parentae1461cedc245a2c85fa7afb84b53e310f945eb9 (diff)
downloadwee-slack-5d8275080e3d325541b2a22c38356113ddaab027.tar.gz
Add number of channels/pvs to list workspaces command
-rw-r--r--slack/commands.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/slack/commands.py b/slack/commands.py
index 4bf477a..6a3e2ac 100644
--- a/slack/commands.py
+++ b/slack/commands.py
@@ -132,6 +132,14 @@ def list_workspaces(workspace_name: Optional[str] = None, detailed_list: bool =
def display_workspace(workspace: SlackWorkspace, detailed_list: bool):
if workspace.is_connected:
+ num_pvs = len(
+ [
+ conversation
+ for conversation in workspace.open_conversations.values()
+ if conversation.buffer_type == "private"
+ ]
+ )
+ num_channels = len(workspace.open_conversations) - num_pvs
weechat.prnt(
"",
f" * "
@@ -140,7 +148,7 @@ def display_workspace(workspace: SlackWorkspace, detailed_list: bool):
f"connected"
f"{with_color('chat_delimiters', ']')}"
f", nick: {workspace.my_user.nick.format()}"
- f", 0 channel(s), 0 pv",
+ f", {num_channels} channel(s), {num_pvs} pv",
)
else:
weechat.prnt("", f" {with_color('chat_server', workspace.name)}")