- Inline-Querys werden jetzt unterstützt!

-> Das erste Plugin mit Inline-Query-Support ist "Echo", das wie @bold funktioniert
-> Neue Variable zur Config hinzugefügt, mit der man bestimmen kann, ob nur whitelisted User oder alle Inline-Querys benutzen können
- AFK zeigt AFK-Text jetzt fett an
This commit is contained in:
Andreas Bielawski
2016-07-13 01:00:32 +02:00
parent d09ddc7520
commit 7ce4411a65
6 changed files with 87 additions and 23 deletions

View File

@@ -95,7 +95,9 @@ function afk:pre_process(msg, self)
redis:hset(hash, 'afk', false)
if afk_text then
redis:hset(hash, 'afk_text', false)
utilities.send_message(self, msg.chat.id, user_name..' ist wieder da (war: '..afk_text..' für '..duration..')!')
local afk_text = afk_text:gsub("%*","")
local afk_text = afk_text:gsub("_","")
utilities.send_message(self, msg.chat.id, user_name..' ist wieder da (war: *'..afk_text..'* für '..duration..')!', true, nil, true)
else
utilities.send_message(self, msg.chat.id, user_name..' ist wieder da (war '..duration..' weg)!')
end

View File

@@ -6,25 +6,37 @@ echo.command = 'echo <Text>'
function echo:init(config)
echo.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('echo', true).table
echo.inline_triggers = {
"^e (.*)"
}
echo.doc = [[*
]]..config.cmd_pat..[[echo* _<Text>_: Gibt den Text aus]]
end
function echo:inline_callback(inline_query, config, matches)
local text = matches[1]
local results = '['
-- enable custom markdown button
if text:match('%[.*%]%(.*%)') or text:match('%*.*%*') or text:match('_.*_') or text:match('`.*`') then
results = results..'{"type":"article","id":"'..math.random(100000000000000000)..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/custom.jpg","title":"Eigenes Markdown","description":"'..text..'","input_message_content":{"message_text":"'..text..'","parse_mode":"Markdown"}},'
end
local results = results..'{"type":"article","id":"'..math.random(100000000000000000)..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/fett.jpg","title":"Fett","description":"*'..text..'*","input_message_content":{"message_text":"*'..text..'*","parse_mode":"Markdown"}},{"type":"article","id":"'..math.random(100000000000000000)..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/kursiv.jpg","title":"Kursiv","description":"_'..text..'_","input_message_content":{"message_text":"_'..text..'_","parse_mode":"Markdown"}},{"type":"article","id":"'..math.random(100000000000000000)..'","thumb_url":"https://anditest.perseus.uberspace.de/inlineQuerys/echo/fixedsys.jpg","title":"Feste Breite","description":"`'..text..'`","input_message_content":{"message_text":"`'..text..'`","parse_mode":"Markdown"}}]'
utilities.answer_inline_query(self, inline_query, results, 0)
end
function echo:action(msg)
local input = utilities.input(msg.text)
if not input then
utilities.send_message(self, msg.chat.id, echo.doc, true, msg.message_id, true)
else
local output
if msg.chat.type == 'supergroup' then
output = '*Echo:*\n"' .. utilities.md_escape(input) .. '"'
end
utilities.send_message(self, msg.chat.id, input, true, nil, true)
local input = utilities.input(msg.text)
if not input then
utilities.send_message(self, msg.chat.id, echo.doc, true, msg.message_id, true)
else
local output
if msg.chat.type == 'supergroup' then
output = '*Echo:*\n"' .. utilities.md_escape(input) .. '"'
end
utilities.send_message(self, msg.chat.id, input, true, nil, true)
end
end
return echo