aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2019-06-02 21:19:22 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2019-06-02 23:09:20 +0200
commitdddb6d674985be2c17fec0297d6dc138c9c95c7d (patch)
treeb039515b800215bbb24aee62c08a4848753fb236 /wee_slack.py
parent20456e353d3a34bd6395f771edde0d816c922cea (diff)
downloadwee-slack-dddb6d674985be2c17fec0297d6dc138c9c95c7d.tar.gz
Add completion for channel names
Fixes #235
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index b4f69ec..2aea305 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -937,6 +937,19 @@ def typing_bar_item_cb(data, item, current_window, current_buffer, extra_info):
@utf8_decode
+def channel_completion_cb(data, completion_item, current_buffer, completion):
+ """
+ Adds all channels on all teams to completion list
+ """
+
+ for team in EVENTROUTER.teams.values():
+ for channel in team.channels.values():
+ if channel.active:
+ w.hook_completion_list_add(completion, channel.name, 0, w.WEECHAT_LIST_POS_SORT)
+ return w.WEECHAT_RC_OK
+
+
+@utf8_decode
def nick_completion_cb(data, completion_item, current_buffer, completion):
"""
Adds all @-prefixed nicks to completion list
@@ -4227,6 +4240,7 @@ def setup_hooks():
description = textwrap.dedent(doc[1])
w.hook_command(cmd, description, args, '', '', 'command_' + cmd, '')
+ w.hook_completion("irc_channels", "complete channels for slack", "channel_completion_cb", "")
w.hook_completion("nicks", "complete @-nicks for slack", "nick_completion_cb", "")
w.hook_completion("usergroups", "complete @-usergroups for slack", "usergroups_completion_cb", "")
w.hook_completion("emoji", "complete :emoji: for slack", "emoji_completion_cb", "")