aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTollef Fog Heen <tfheen@err.no>2016-03-05 12:44:26 +0100
committerTollef Fog Heen <tfheen@err.no>2016-03-05 12:44:26 +0100
commit67d675338883ca4d5161c624a18ad564d591b05d (patch)
tree9326528a7998b9227283b68197da0f094a6f468f /wee_slack.py
parentefb41803ed9293f0724da2c93898abd481a3a908 (diff)
downloadwee-slack-67d675338883ca4d5161c624a18ad564d591b05d.tar.gz
Implement `/msg user message`
Fixes: #167
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 6172636..790589e 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -974,6 +974,24 @@ def slack_buffer_required(f):
@slack_buffer_required
+def msg_command_cb(data, current_buffer, args):
+ dbg("msg_command_cb")
+ aargs = args.split(None, 2)
+ who = aargs[1]
+
+ dbg(who)
+ command_talk(current_buffer, who)
+
+ if len(aargs) > 2:
+ message = aargs[2]
+ server = servers.find(current_domain_name())
+ if server:
+ channel = server.channels.find(who)
+ channel.send_message(message)
+ return w.WEECHAT_RC_OK_EAT
+
+
+@slack_buffer_required
def command_upload(current_buffer, args):
"""
Uploads a file to the current buffer
@@ -2186,6 +2204,7 @@ if __name__ == "__main__":
w.hook_command_run('/part', 'part_command_cb', '')
w.hook_command_run('/leave', 'part_command_cb', '')
w.hook_command_run('/topic', 'topic_command_cb', '')
+ w.hook_command_run('/msg', 'msg_command_cb', '')
w.hook_command_run("/input complete_next", "complete_next_cb", "")
w.hook_completion("nicks", "complete @-nicks for slack",
"nick_completion_cb", "")