aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2017-05-18 10:44:36 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2017-05-18 10:44:36 +0200
commit156ea32a90860d5d9dc3177ca4fa98f6b0483115 (patch)
tree071c98a7fb9c1ad43c61c2317229b88e9eb0a471
parentf744681b174004a4932e90ecc13d140bf2e1c5b3 (diff)
downloadxK-156ea32a90860d5d9dc3177ca4fa98f6b0483115.tar.gz
xK-156ea32a90860d5d9dc3177ca4fa98f6b0483115.tar.xz
xK-156ea32a90860d5d9dc3177ca4fa98f6b0483115.zip
slack.lua: support @here and @channel
-rw-r--r--plugins/degesch/slack.lua15
1 files changed, 10 insertions, 5 deletions
diff --git a/plugins/degesch/slack.lua b/plugins/degesch/slack.lua
index 456d3b0..87786da 100644
--- a/plugins/degesch/slack.lua
+++ b/plugins/degesch/slack.lua
@@ -85,12 +85,17 @@ degesch.hook_completion (function (hook, data, word)
local needle = word:gsub ("^@", ""):lower ()
local t = {}
- for i, chan_user in ipairs (chan.users) do
- local nick = chan_user.user.nickname
- if data.location == 0 then nick = nick .. ":" end
- if nick:sub (1, #needle):lower () == needle then
- table.insert (t, "@" .. nick)
+ local try = function (name)
+ if data.location == 0 then name = name .. ":" end
+ if name:sub (1, #needle):lower () == needle then
+ table.insert (t, "@" .. name)
end
end
+ for _, chan_user in ipairs (chan.users) do
+ try (chan_user.user.nickname)
+ end
+ for _, special in ipairs { "channel", "here" } do
+ try (special)
+ end
return t
end)