aboutsummaryrefslogtreecommitdiffstats
path: root/slack/commands.py
diff options
context:
space:
mode:
authorPierguido Lambri <plambri@redhat.com>2024-01-13 18:35:36 +0000
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 12:55:39 +0100
commit3b6bc38b53ca9ea81c8a055c78b9d93f0d75768b (patch)
treeaed4439a3491bca17c18174c1f5e5b2c1b639552 /slack/commands.py
parent0531090db0976b1261a033dd2eabd4c641a91d2c (diff)
downloadwee-slack-3b6bc38b53ca9ea81c8a055c78b9d93f0d75768b.tar.gz
Set user status
It's now possible to set and clear the uses status. For now it's not possible to set the status emoji or the status expiration. Signed-off-by: Pierguido Lambri <plambri@redhat.com>
Diffstat (limited to 'slack/commands.py')
-rw-r--r--slack/commands.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/slack/commands.py b/slack/commands.py
index da53244..48f7b23 100644
--- a/slack/commands.py
+++ b/slack/commands.py
@@ -366,6 +366,23 @@ def command_slack_debug(buffer: str, args: List[str], options: Options):
print_uncaught_error(error, True, options)
+@weechat_command("-clean")
+def command_slack_status(buffer: str, args: List[str], options: Options):
+ status = args[0]
+ slack_buffer = shared.buffers.get(buffer)
+ if slack_buffer is not None:
+ if options.get("clean"):
+ run_async(slack_buffer.workspace.api.clear_user_status())
+ elif slack_buffer and len(status) > 0:
+ run_async(slack_buffer.workspace.api.set_user_status(status))
+ else:
+ print_error(
+ 'Too few arguments for command "/slack status" (help on command: /help slack status)'
+ )
+ else:
+ print_error("Run the command in a slack buffer")
+
+
def completion_slack_workspaces_cb(
data: str, completion_item: str, buffer: str, completion: str
) -> int: