Ein paar fixes

This commit is contained in:
Akamaru 2016-11-13 22:40:24 +01:00
parent 1b674b2d30
commit 79e7446eb9
3 changed files with 27 additions and 15 deletions

View File

@ -13,21 +13,30 @@ end
mal_user.command = 'malu <User>'
function mal_user:get_infos(user)
local url = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D%22http%3A%2F%2Fmyanimelist.net%2Fmalappinfo.php%3Fu%3D'..user..'%22&format=json&diagnostics=true&callback='
local url = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D%22http%3A%2F%2Fmyanimelist.net%2Fmalappinfo.php%3Fu%3D'..user..'%22&format=json'
local res, code = https.request(url)
if code ~= 200 then return nil end
local data = json.decode(res).query.results.myanimelist.myinfo
if not data then return nil end
local name = data.user_name
local watching = data.user_watching
local pause = data.user_onhold
local dropped = data.user_dropped
local complete = data.user_completed
local planed = data.user_plantowatch
local mal_url = 'http://myanimelist.net/profile/'..data.user_name
local text = '<b>'..name..'</b> schaut derzeit <b>'..watching..' Animes</b>, hat <b>'..pause..' pausiert</b>, <b>'..dropped..' abgebrochen</b> und <b>'..complete..' beendet</b>. <b>'..planed..'</b> stehen auf der Watchlist.\n<a href="'..mal_url..'">Profil aufrufen</a>'
local name = '<b>'..data.user_name..'</b>'
local id = ' <i>(ID '..data.user_id..')</i>'
if data.user_watching == '1' then
watching = '<b>'..data.user_watching..' Anime</b>'
else
watching = '<b>'..data.user_watching..' Animes</b>'
end
local pause = '<b>'..data.user_onhold..' pausiert</b>'
local dropped = '<b>'..data.user_dropped..' abgebrochen</b>'
local complete = '<b>'..data.user_completed..' beendet</b>'
if data.user_plantowatch == '1' then
planed = '<b>'..data.user_plantowatch..'</b> steht'
else
planed = '<b>'..data.user_plantowatch..'</b> stehen'
end
local mal_url = '<a href="http://myanimelist.net/profile/'..data.user_name..'">Profil aufrufen</a>'
local text = name..id..' schaut derzeit '..watching..', hat '..pause..', '..dropped..' und '..complete..'. '..planed..' auf der Watchlist.\n'..mal_url
return text
end

View File

@ -52,7 +52,10 @@ function fun:choose_random(user_name, other_user)
user_name..' schickt '..other_user..' nach Bikini Bottom.',
user_name..' beamt '..other_user..' hoch.',
user_name..' und '..other_user..' sind taube Nüsschen. Yeah!',
user_name..' schmiert Hundescheiße auf '..other_user..'s Nike Air.'
user_name..' schmiert Hundescheiße auf '..other_user..'s Nike Air.',
user_name..' erstellt eine falsche Route auf '..other_user..'s Navi.',
user_name..' zieht '..other_user..' die Hose aus.',
user_name..' schenkt '..other_user..' Bibis Beauty-Cream.'
}
math.randomseed(os.time())
math.randomseed(os.time())

View File

@ -2,6 +2,8 @@ local special = {}
special.triggers = {
"[Rr][Ii][Cc][Hh] [Bb][Ii][Tt][Cc][Hh]",
"[Mm]ö[Dd][Cc][Hh][Ee][Nn]",
"[Mm]Ö[Dd][Cc][Hh][Ee][Nn]",
"^[Mm][Ii][Kk][Uu]%??$",
"^/[Oo][Ll][Dd]$",
"^[Nn][Yy][Uu]$",
@ -22,8 +24,6 @@ special.triggers = {
"^[Yy][Oo][Ll][Oo]$",
"[Ii] [Ww][Ii][Ss][Hh] [Ss][Qq][Uu][Ii][Dd][Ss] [Ww][Ee][Rr][Ee] [Rr][Ee][Aa][Ll]",
"^/[Kk][Ii][Ll][Ll] (.*)",
"[Mm]ö[Dd][Cc][Hh][Ee][Nn]",
"[Mm]Ö[Dd][Cc][Hh][Ee][Nn]",
"^[Pp][Ee]$",
"^[Vv][Aa]$",
"^[Mm][Uu]$",
@ -43,6 +43,8 @@ function special:action(msg, config, matches)
if msg_text:match("[Rr][Ii][Cc][Hh] [Bb][Ii][Tt][Cc][Hh]") then
output = 'Akamaru ist nicht reich!'
elseif msg_text:match("[Mm]ö[Dd][Cc][Hh][Ee][Nn]") or msg_text:match("[Mm]Ö[Dd][Cc][Hh][Ee][Nn]") then
output = 'Es heißt MÄDCHEN!'
elseif string.match(msg.text, "[Mm][Ii][Kk][Uu]%??") then
local alive_answers = {'Ja?','Was gibts, '..user_name..'?','Ja '..user_name..', was ist?', 'Ich bin noch da.', user_name, 'Nein!','So heiße ich', 'Nerv mich nicht!','Was.'}
local random_alive = math.random(9)
@ -101,8 +103,6 @@ function special:action(msg, config, matches)
return
elseif msg_text:match("[Kk][Ii][Ll][Ll]") then
output = user_name..' tötet '..matches[1]
elseif msg_text:match("[Mm]ö[Dd][Cc][Hh][Ee][Nn]") or msg_text:match("[Mm]Ö[Dd][Cc][Hh][Ee][Nn]") then
output = 'Es heißt MÄDCHEN!'
elseif msg_text:match("[Pp][Ee]") then
output = 'nis'
elseif msg_text:match("[Vv][Aa]") then