diff options
author | Ryan Huber <rhuber@gmail.com> | 2017-04-18 09:49:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-18 09:49:07 -0700 |
commit | f4746f965bc54e2511fa6adc9ec9909c88c4f479 (patch) | |
tree | dec30c132cf51b749a62575ed456591f1cc92f8b | |
parent | 27276faabffd3c63623d9215e1b39f3e06afc307 (diff) | |
parent | 8e59ca670cfc417c412449077784ddd662c9fda5 (diff) | |
download | wee-slack-f4746f965bc54e2511fa6adc9ec9909c88c4f479.tar.gz |
Merge pull request #347 from V13Axel/status_command
Add command for setting Slack Status
-rw-r--r-- | README.md | 13 | ||||
-rw-r--r-- | wee_slack.py | 25 |
2 files changed, 38 insertions, 0 deletions
@@ -13,6 +13,7 @@ A WeeChat native client for Slack.com. Provides supplemental features only avail Features -------- * **New** [Threads](#threads) support! + * **New** [Slack Status](#status) support! * Slash commands (including custom ones!) * Upload to slack capabilities! * Emoji reactions! @@ -209,6 +210,18 @@ Label a thread with a memorable name. The above command will open a channel call ``` _Note: labels do not persist once a thread buffer is closed_ +#### Status + +Set your Slack status on a given team: +``` +/slack status [:emoji:] [Status message] +``` + +Example: +``` +/slack status :ghost: Boo! +``` + Optional settings ----------------- diff --git a/wee_slack.py b/wee_slack.py index 4122254..a3d43ce 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -3030,6 +3030,31 @@ def command_away(data, current_buffer, args): @slack_buffer_required +def command_status(data, current_buffer, args): + """ + Lets you set your Slack Status (not to be confused with away/here) + /slack status [emoji] [status_message] + """ + e = EVENTROUTER + channel = e.weechat_controller.buffers.get(current_buffer, None) + if channel: + team = channel.team + + if args is None: + server.buffer_prnt("Usage: /slack status [status emoji] [status text].") + return + + split_args = args.split(None, 2) + emoji = split_args[1] if len(split_args) > 1 else "" + text = split_args[2] if len(split_args) > 2 else "" + + profile = {"status_text":text,"status_emoji":emoji} + + s = SlackRequest(team.token, "users.profile.set", {"profile": profile}, team_hash=team.team_hash, channel_identifier=channel.identifier) + EVENTROUTER.receive(s) + + +@slack_buffer_required def command_back(data, current_buffer, args): """ Sets your status as 'back' |