37 lines
1.1 KiB
Lua
37 lines
1.1 KiB
Lua
-- This is a proprietary plugin, property of Andreas Bielawski, (c) 2015 <andi (dot) b (at) outlook (dot) de>
|
|
-- DO NOT USE WITHOUT PERMISSION
|
|
|
|
do
|
|
|
|
local BASE_URL = 'https://love-calculator.p.mashape.com'
|
|
|
|
local function love_result(first_name, second_name)
|
|
local apikey = cred_data.x_mashape_key
|
|
local url = BASE_URL..'/getPercentage?mashape-key='..apikey..'&fname='..first_name..'&sname='..second_name
|
|
print(url)
|
|
local res,code = https.request(url)
|
|
if code ~= 200 then return "HTTP-FEHLER" end
|
|
local data = json:decode(res)
|
|
local first_name = data.fname
|
|
local second_name = data.sname
|
|
local percentage = data.percentage
|
|
local result = data.result
|
|
return first_name..' und '..second_name..' lieben sich zu '..percentage..'% ❤️\n'..result
|
|
end
|
|
|
|
local function run(msg, matches)
|
|
local first_name = url_encode(matches[1])
|
|
local second_name = url_encode(matches[2])
|
|
return love_result(first_name, second_name)
|
|
end
|
|
|
|
return {
|
|
description = "Liebestest ❤️ (kommt sogar ohne Jamba-Abo!)",
|
|
usage = "#love [Erster Name]+[Zweiter Name]: Führt einen Liebestest durch ❤️",
|
|
patterns = {
|
|
"^#love (.+)+(.+)$"
|
|
},
|
|
run = run
|
|
}
|
|
|
|
end |