Add completion for channel names
Fixes
@@ -936,6 +936,19 @@ def typing_bar_item_cb(data, item, current_window, current_buffer, extra_info):
return typing
+@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):
"""
@@ -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", "")
