Wikipedia: InlineKeyboard für Artikel

This commit is contained in:
Andreas Bielawski 2016-07-09 14:19:42 +02:00
parent 214bd60df0
commit 0383799ed9

View File

@ -126,7 +126,7 @@ function wikipedia:wikintro(text, lang)
local lang = lang or "de" local lang = lang or "de"
local title = page.title local title = page.title
local title_enc = URL.escape(title) local title_enc = URL.escape(title)
return '*'..title.."*:\n"..utilities.md_escape(page.extract).."\n[Auf Wikipedia ansehen](https://"..lang..".wikipedia.org/wiki/"..title_enc..")" return '*'..title.."*:\n"..utilities.md_escape(page.extract), '{"inline_keyboard":[[{"text":"Artikel aufrufen","url":"https://'..lang..'.wikipedia.org/wiki/'..title_enc..'"}]]}'
else else
local text = text.." nicht gefunden" local text = text.." nicht gefunden"
return text return text
@ -180,9 +180,9 @@ function wikipedia:action(msg, config, matches)
if search then if search then
result = wikipedia:wikisearch(term, lang) result = wikipedia:wikisearch(term, lang)
else else
result = wikipedia:wikintro(term, lang) result, keyboard = wikipedia:wikintro(term, lang)
end end
utilities.send_reply(self, msg, result, true) utilities.send_reply(self, msg, result, true, keyboard)
end end
return wikipedia return wikipedia