slack.lua: support @here and @channel
This commit is contained in:
parent
f744681b17
commit
156ea32a90
|
@ -85,12 +85,17 @@ degesch.hook_completion (function (hook, data, word)
|
||||||
local needle = word:gsub ("^@", ""):lower ()
|
local needle = word:gsub ("^@", ""):lower ()
|
||||||
|
|
||||||
local t = {}
|
local t = {}
|
||||||
for i, chan_user in ipairs (chan.users) do
|
local try = function (name)
|
||||||
local nick = chan_user.user.nickname
|
if data.location == 0 then name = name .. ":" end
|
||||||
if data.location == 0 then nick = nick .. ":" end
|
if name:sub (1, #needle):lower () == needle then
|
||||||
if nick:sub (1, #needle):lower () == needle then
|
table.insert (t, "@" .. name)
|
||||||
table.insert (t, "@" .. nick)
|
|
||||||
end
|
end
|
||||||
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
|
return t
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in New Issue