aboutsummaryrefslogtreecommitdiffstats
path: root/slack/commands.py
diff options
context:
space:
mode:
authorPier <pierg75@yahoo.it>2024-02-18 10:54:01 +0000
committerGitHub <noreply@github.com>2024-02-18 11:54:01 +0100
commit0531090db0976b1261a033dd2eabd4c641a91d2c (patch)
tree270a8a13c683260d81a7b27f17f7a61068be59aa /slack/commands.py
parent1989a394e96df843a1e5d852e9706cafcf6c0945 (diff)
downloadwee-slack-0531090db0976b1261a033dd2eabd4c641a91d2c.tar.gz
Set user user presence (#919)
The user can now set the presence with: /slack presence away Or: /slack presence active Signed-off-by: Pierguido Lambri <plambri@redhat.com>
Diffstat (limited to 'slack/commands.py')
-rw-r--r--slack/commands.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/slack/commands.py b/slack/commands.py
index a866894..da53244 100644
--- a/slack/commands.py
+++ b/slack/commands.py
@@ -287,6 +287,20 @@ def command_slack_reply(buffer: str, args: List[str], options: Options):
run_async(slack_buffer.post_message(split_args[1], thread_ts, broadcast))
+@weechat_command("away|active")
+def command_slack_presence(buffer: str, args: List[str], options: Options):
+ slack_buffer = shared.buffers.get(buffer)
+ if slack_buffer is None:
+ return
+ new_presence = args[0]
+ if new_presence not in ("active", "away"):
+ print_error(
+ f'Error with command "/slack presence {args[0]}" (help on command: /help slack presence)'
+ )
+ return
+ run_async(slack_buffer.workspace.api.set_presence(new_presence))
+
+
def print_uncaught_error(error: UncaughtError, detailed: bool, options: Options):
weechat.prnt("", f" {error.id} ({error.time}): {error.exception}")
if detailed: