diff options
author | Pier <pierg75@yahoo.it> | 2024-02-18 10:54:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-18 11:54:01 +0100 |
commit | 0531090db0976b1261a033dd2eabd4c641a91d2c (patch) | |
tree | 270a8a13c683260d81a7b27f17f7a61068be59aa /slack/commands.py | |
parent | 1989a394e96df843a1e5d852e9706cafcf6c0945 (diff) | |
download | wee-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.py | 14 |
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: |