2016-06-14 12:21:16 +02:00
|
|
|
local respond = {}
|
|
|
|
|
|
|
|
function respond:init(config)
|
|
|
|
respond.triggers = {
|
2017-01-10 23:53:16 +01:00
|
|
|
"/[Ss][Hh][Rr][Uu][Gg]",
|
2016-06-14 12:21:16 +02:00
|
|
|
"^/([Ll][Oo][Dd])$",
|
2017-01-10 23:53:16 +01:00
|
|
|
"/([Ll][Ff])",
|
2016-06-14 12:21:16 +02:00
|
|
|
"^/([Kk][Aa])$",
|
|
|
|
"^/([Ii][Dd][Kk])$",
|
|
|
|
"^/([Nn][Bb][Cc])$",
|
|
|
|
"^/([Ii][Dd][Cc])$",
|
|
|
|
"^%*([Ff][Rr][Oo][Ss][Cc][Hh])%*",
|
|
|
|
"^/([Ff][Rr][Oo][Ss][Cc][Hh])$",
|
|
|
|
"^%(([Ii][Nn][Ll][Oo][Vv][Ee])%)$",
|
|
|
|
"^/[Ww][Aa][Tt]$"
|
|
|
|
}
|
2016-07-19 20:20:27 +02:00
|
|
|
|
|
|
|
respond.inline_triggers = {
|
|
|
|
"^([Ll][Oo][Dd])$",
|
|
|
|
"^([Ll][Ff])$",
|
|
|
|
"^([Kk][Aa])$",
|
|
|
|
"^([Ii][Dd][Kk])$",
|
|
|
|
"^([Nn][Bb][Cc])$",
|
|
|
|
"^([Ii][Dd][Cc])$",
|
|
|
|
}
|
2016-06-14 12:21:16 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
respond.command = 'lod, /lf, /nbc, /wat'
|
|
|
|
|
2016-07-19 20:20:27 +02:00
|
|
|
function respond:inline_callback(inline_query, config, matches)
|
|
|
|
local text = matches[1]
|
|
|
|
if string.match(text, "[Ll][Oo][Dd]") then
|
2016-07-19 20:26:07 +02:00
|
|
|
face = 'ಠ_ಠ'
|
2016-07-19 20:20:27 +02:00
|
|
|
elseif string.match(text, "[Ll][Ff]") then
|
2016-07-19 20:26:07 +02:00
|
|
|
face = '( ͡° ͜ʖ ͡°)'
|
2016-07-19 20:20:27 +02:00
|
|
|
elseif string.match(text, "[Nn][Bb][Cc]") or string.match(text, "[Ii][Dd][Cc]") or string.match(text, "[Kk][Aa]") or string.match(text, "[Ii][Dd][Kk]") then
|
2016-07-19 20:26:07 +02:00
|
|
|
face = '¯\\\\\\_(ツ)_/¯'
|
2016-07-19 20:20:27 +02:00
|
|
|
end
|
2016-08-07 21:20:48 +02:00
|
|
|
results = '[{"type":"article","id":"8","title":"'..face..'","input_message_content":{"message_text":"'..face..'"}}]'
|
2016-08-24 15:38:29 +02:00
|
|
|
utilities.answer_inline_query(inline_query, results, 9999)
|
2016-07-19 20:20:27 +02:00
|
|
|
end
|
|
|
|
|
2016-06-14 12:21:16 +02:00
|
|
|
function respond:action(msg, config, matches)
|
|
|
|
local user_name = get_name(msg)
|
|
|
|
local receiver = msg.chat.id
|
2016-08-11 17:03:23 +02:00
|
|
|
local BASE_URL = 'https://anditest.perseus.uberspace.de/plugins/respond'
|
2016-06-14 12:21:16 +02:00
|
|
|
if user_name == "DefenderX" then user_name = "Deffu" end
|
|
|
|
|
2017-03-08 21:44:03 +01:00
|
|
|
if string.match(msg.text, "[Ll][Oo][Dd]") then
|
2016-08-24 15:38:29 +02:00
|
|
|
utilities.send_message(receiver, 'ಠ_ಠ')
|
2016-06-14 12:21:16 +02:00
|
|
|
return
|
|
|
|
elseif string.match(msg.text, "[Ll][Ff]") then
|
2016-08-24 15:38:29 +02:00
|
|
|
utilities.send_message(receiver, '( ͡° ͜ʖ ͡°)')
|
2016-06-14 12:21:16 +02:00
|
|
|
return
|
2017-01-10 23:53:16 +01:00
|
|
|
elseif string.match(msg.text, "[Nn][Bb][Cc]") or string.match(msg.text, "[Ii][Dd][Cc]") or string.match(msg.text, "[Kk][Aa]") or string.match(msg.text, "[Ii][Dd][Kk]") or string.match(msg.text, "/[Ss][Hh][Rr][Uu][Gg]") then
|
2016-08-24 15:38:29 +02:00
|
|
|
utilities.send_message(receiver, [[¯\_(ツ)_/¯]])
|
2016-06-14 12:21:16 +02:00
|
|
|
return
|
|
|
|
elseif string.match(msg.text, "[Ff][Rr][Oo][Ss][Cc][Hh]") then
|
2016-08-24 15:38:29 +02:00
|
|
|
utilities.send_message(receiver, '🐸🐸🐸')
|
2016-06-14 12:21:16 +02:00
|
|
|
return
|
|
|
|
elseif string.match(msg.text, "[Ii][Nn][Ll][Oo][Vv][Ee]") then
|
2016-08-11 17:03:23 +02:00
|
|
|
local file = download_to_file(BASE_URL..'/inlove.gif')
|
2016-08-24 15:38:29 +02:00
|
|
|
utilities.send_document(receiver, file)
|
2016-06-14 12:21:16 +02:00
|
|
|
return
|
|
|
|
elseif string.match(msg.text, "[Ww][Aa][Tt]") then
|
2016-08-11 17:03:23 +02:00
|
|
|
local WAT_URL = BASE_URL..'/wat'
|
2016-06-14 12:21:16 +02:00
|
|
|
local wats = {
|
|
|
|
"/wat1.jpg",
|
|
|
|
"/wat2.jpg",
|
|
|
|
"/wat3.jpg",
|
|
|
|
"/wat4.jpg",
|
|
|
|
"/wat5.jpg",
|
|
|
|
"/wat6.jpg",
|
|
|
|
"/wat7.jpg",
|
|
|
|
"/wat8.jpg"
|
|
|
|
}
|
|
|
|
local random_wat = math.random(5)
|
|
|
|
local file = download_to_file(WAT_URL..wats[random_wat])
|
2016-08-24 15:38:29 +02:00
|
|
|
utilities.send_photo(receiver, file, nil, msg.message_id)
|
2016-06-14 12:21:16 +02:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
return respond
|