ID: Funktioniert jetzt auch inline

This commit is contained in:
Andreas Bielawski 2016-08-13 16:01:01 +02:00
parent cbc72d8fe0
commit b49088b9fe

View File

@ -3,11 +3,16 @@ local id = {}
id.command = 'id' id.command = 'id'
function id:init(config) function id:init(config)
id.triggers = { id.triggers = {
"^/id$", "^/id$",
"^/ids? (chat)$" "^/ids? (chat)$"
} }
id.doc = [[```
id.inline_triggers = {
"^id$"
}
id.doc = [[```
Returns user and chat info for you or the replied-to message. Returns user and chat info for you or the replied-to message.
Alias: ]]..config.cmd_pat..[[who Alias: ]]..config.cmd_pat..[[who
```]] ```]]
@ -44,6 +49,14 @@ function id:get_user(user_id, chat_id)
return user_info return user_info
end end
function id:inline_callback(inline_query, config, matches)
local id = tostring(inline_query.from.id)
local name = utilities.build_name(inline_query.from.first_name, inline_query.from.last_name)
local results = '[{"type":"article","id":"30","title":"Deine Telegram-ID ist:","description":"'..id..'","input_message_content":{"message_text":"<b>'..name..'</b>: <code>'..id..'</code>","parse_mode":"HTML"}}]'
utilities.answer_inline_query(self, inline_query, results, 10000)
end
function id:action(msg, config, matches) function id:action(msg, config, matches)
if matches[1] == "/id" then if matches[1] == "/id" then