aboutsummaryrefslogtreecommitdiffstats
path: root/slack/commands.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-01-21 02:35:36 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:53 +0100
commitec5e23bd7a6a928a1b0aa28fadc9b6554c7b2641 (patch)
tree45e0a8385cb619e124ccaf93ddd00c6a7c88e658 /slack/commands.py
parent3ae792a3cd858261c3b8fc7a0e1cdd9fa570096e (diff)
downloadwee-slack-ec5e23bd7a6a928a1b0aa28fadc9b6554c7b2641.tar.gz
Add a /slack debug command
Diffstat (limited to 'slack/commands.py')
-rw-r--r--slack/commands.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/slack/commands.py b/slack/commands.py
index 457d43e..41abbde 100644
--- a/slack/commands.py
+++ b/slack/commands.py
@@ -1,5 +1,6 @@
from __future__ import annotations
+import pprint
import re
from dataclasses import dataclass
from functools import wraps
@@ -211,6 +212,21 @@ def command_slack_workspace_del(
)
+@weechat_command("tasks|buffer")
+def command_slack_debug(
+ buffer: str, args: List[str], options: Dict[str, Optional[str]]
+):
+ if args[0] == "tasks":
+ weechat.prnt("", "Active tasks:")
+ weechat.prnt("", pprint.pformat(shared.active_tasks))
+ weechat.prnt("", "Active futures:")
+ weechat.prnt("", pprint.pformat(shared.active_futures))
+ elif args[0] == "buffer":
+ conversation = get_conversation_from_buffer_pointer(buffer)
+ if conversation:
+ weechat.prnt("", f"Conversation id: {conversation.id}")
+
+
def completion_slack_workspaces_cb(
data: str, completion_item: str, buffer: str, completion: str
) -> int: