MyAnimeList: Anpassung auf HTML
This commit is contained in:
parent
8a84a228ce
commit
301e99fec1
@ -64,7 +64,7 @@ function mal:get_mal_info(query, typ)
|
||||
end
|
||||
|
||||
function mal:send_anime_data(result, receiver)
|
||||
local title = '*'..xml.find(result, 'title')[1]..'*'
|
||||
local title = '<b>'..xml.find(result, 'title')[1]..'</b>'
|
||||
local id = xml.find(result, 'id')[1]
|
||||
local mal_url = 'https://myanimelist.net/anime/'..id
|
||||
|
||||
@ -75,19 +75,19 @@ function mal:send_anime_data(result, receiver)
|
||||
end
|
||||
|
||||
if xml.find(result, 'english')[1] then
|
||||
eng = '\nEnglisch: *'..xml.find(result, 'english')[1]..'*'
|
||||
eng = '\n<b>Englisch:</b> '..xml.find(result, 'english')[1]
|
||||
else
|
||||
eng = ''
|
||||
end
|
||||
|
||||
if xml.find(result, 'synonyms')[1] then
|
||||
syno = '\nAlternativ: *'..xml.find(result, 'synonyms')[1]..'*'
|
||||
syno = '\n<b>Alternativ:</b> '..xml.find(result, 'synonyms')[1]
|
||||
else
|
||||
syno = ''
|
||||
end
|
||||
|
||||
if xml.find(result, 'episodes')[1] then
|
||||
episodes = '\nEpisoden: '..xml.find(result, 'episodes')[1]
|
||||
episodes = '\n<b>Episoden:</b> '..xml.find(result, 'episodes')[1]
|
||||
else
|
||||
episodes = ''
|
||||
end
|
||||
@ -99,13 +99,13 @@ function mal:send_anime_data(result, receiver)
|
||||
end
|
||||
|
||||
if xml.find(result, 'score')[1] ~= "0.00" then
|
||||
score = '\nScore: '..string.gsub(xml.find(result, 'score')[1], "%.", ",")
|
||||
score = '\n<b>Score:</b> '..string.gsub(xml.find(result, 'score')[1], "%.", ",")
|
||||
else
|
||||
score = ''
|
||||
end
|
||||
|
||||
if xml.find(result, 'start_date')[1] ~= "0000-00-00" then
|
||||
startdate = '\nAusstrahlung: '..makeOurDate(xml.find(result, 'start_date')[1])
|
||||
startdate = '\n<b>Ausstrahlung:</b> '..makeOurDate(xml.find(result, 'start_date')[1])
|
||||
else
|
||||
startdate = ''
|
||||
end
|
||||
@ -117,19 +117,21 @@ function mal:send_anime_data(result, receiver)
|
||||
end
|
||||
|
||||
if xml.find(result, 'synopsis')[1] then
|
||||
desc = '\n_'..unescape(mal:delete_tags(string.sub(xml.find(result, 'synopsis')[1], 1, 250)))..'..._'
|
||||
desc = '\n<i>'..unescape(mal:delete_tags(string.sub(xml.find(result, 'synopsis')[1], 1, 250)))..'...</i>'
|
||||
else
|
||||
desc = ''
|
||||
end
|
||||
|
||||
local text = title..typ..eng..syno..episodes..status..score..startdate..enddate..'\n'..desc..'\n[Auf MyAnimeList ansehen]('..mal_url..')'
|
||||
|
||||
if xml.find(result, 'image') then
|
||||
local image_url = xml.find(result, 'image')[1]
|
||||
return text, image_url
|
||||
image_url = xml.find(result, 'image')[1]
|
||||
else
|
||||
return text
|
||||
end
|
||||
image_url = ''
|
||||
end
|
||||
|
||||
local text = title..typ..eng..syno..episodes..status..score..startdate..enddate..'\n'..desc..'<a href="'..image_url..'"> </a>\n<a href="'..mal_url..'">Auf MyAnimeList ansehen</a>'
|
||||
|
||||
return text
|
||||
|
||||
end
|
||||
|
||||
function mal:send_manga_data(result)
|
||||
@ -150,7 +152,7 @@ function mal:send_manga_data(result)
|
||||
end
|
||||
|
||||
if xml.find(result, 'chapters')[1] then
|
||||
chapters = '\nKapitel: '..xml.find(result, 'chapters')[1]
|
||||
chapters = '\n<b>Kapitel:</b> '..xml.find(result, 'chapters')[1]
|
||||
else
|
||||
chapters = ''
|
||||
end
|
||||
@ -162,19 +164,19 @@ function mal:send_manga_data(result)
|
||||
end
|
||||
|
||||
if xml.find(result, 'volumes')[1] then
|
||||
volumes = '\nBände '..xml.find(result, 'volumes')[1]
|
||||
volumes = '\n<b>Bände:</b> '..xml.find(result, 'volumes')[1]
|
||||
else
|
||||
volumes = ''
|
||||
end
|
||||
|
||||
if xml.find(result, 'score')[1] ~= "0.00" then
|
||||
score = '\nScore: '..xml.find(result, 'score')[1]
|
||||
score = '\n<b>Score:</b> '..xml.find(result, 'score')[1]
|
||||
else
|
||||
score = ''
|
||||
end
|
||||
|
||||
if xml.find(result, 'start_date')[1] ~= "0000-00-00" then
|
||||
startdate = '\nVeröffentlichungszeitraum: '..makeOurDate(xml.find(result, 'start_date')[1])
|
||||
startdate = '\n<b>Veröffentlichungszeitraum:</b> '..makeOurDate(xml.find(result, 'start_date')[1])
|
||||
else
|
||||
startdate = ''
|
||||
end
|
||||
@ -186,18 +188,21 @@ function mal:send_manga_data(result)
|
||||
end
|
||||
|
||||
if xml.find(result, 'synopsis')[1] then
|
||||
desc = '\n'..unescape(mal:delete_tags(string.sub(xml.find(result, 'synopsis')[1], 1, 200))) .. '...'
|
||||
desc = '\n<i>'..unescape(mal:delete_tags(string.sub(xml.find(result, 'synopsis')[1], 1, 200)))..'...</i>'
|
||||
else
|
||||
desc = ''
|
||||
end
|
||||
|
||||
local text = '*'..title..'*'..alt_name..typ..chapters..status..volumes..score..startdate..enddate..'_'..desc..'_\n[Auf MyAnimeList ansehen]('..mal_url..')'
|
||||
if xml.find(result, 'image') then
|
||||
local image_url = xml.find(result, 'image')[1]
|
||||
return text, image_url
|
||||
image_url = xml.find(result, 'image')[1]
|
||||
else
|
||||
return text
|
||||
end
|
||||
image_url = ''
|
||||
end
|
||||
|
||||
local text = title..alt_name..typ..chapters..status..volumes..score..startdate..enddate..desc..'<a href="'..image_url..'"> </a>\n<a href="'..mal_url..'">Auf MyAnimeList ansehen</a>'
|
||||
|
||||
return text
|
||||
|
||||
end
|
||||
|
||||
function mal:action(msg, config, matches)
|
||||
@ -208,12 +213,8 @@ function mal:action(msg, config, matches)
|
||||
utilities.send_reply(msg, 'Anime nicht gefunden!')
|
||||
return
|
||||
else
|
||||
local text, image_url = mal:send_anime_data(anime_info)
|
||||
if image_url then
|
||||
utilities.send_typing(msg.chat.id, 'upload_photo')
|
||||
utilities.send_photo(msg.chat.id, image_url, nil, msg.message_id)
|
||||
end
|
||||
utilities.send_reply(msg, text, true)
|
||||
local text = mal:send_anime_data(anime_info)
|
||||
utilities.send_message(msg.chat.id, text, false, msg.message_id, 'html')
|
||||
return
|
||||
end
|
||||
elseif matches[1] == 'manga' then
|
||||
@ -222,12 +223,8 @@ function mal:action(msg, config, matches)
|
||||
utilities.send_reply(msg, 'Manga nicht gefunden!')
|
||||
return
|
||||
else
|
||||
local text, image_url = mal:send_manga_data(manga_info)
|
||||
if image_url then
|
||||
utilities.send_typing(msg.chat.id, 'upload_photo')
|
||||
utilities.send_photo(msg.chat.id, image_url, nil, msg.message_id)
|
||||
end
|
||||
utilities.send_reply(msg, text, true)
|
||||
local text = mal:send_manga_data(manga_info)
|
||||
utilities.send_message(msg.chat.id, text, false, msg.message_id, 'html')
|
||||
return
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user