Few changes on kitty.lua and url_title.lua

kitty.lua: Code cleanup
url_title.lua: Ignoring deviantart links
This commit is contained in:
Akamaru 2015-04-18 18:48:20 +02:00
parent 5159c65794
commit 94d7d20415
2 changed files with 1 additions and 3 deletions

View File

@ -1,6 +1,5 @@
function run(msg, matches) function run(msg, matches)
if string.starts(msg.text, '/kitty') then
randomValue = math.random(4) randomValue = math.random(4)
if randomValue == 1 then if randomValue == 1 then
send_photo(get_receiver(msg), "pictures/cats/cat1.jpg", ok_cb, false) send_photo(get_receiver(msg), "pictures/cats/cat1.jpg", ok_cb, false)
@ -11,7 +10,6 @@ function run(msg, matches)
elseif randomValue == 4 then elseif randomValue == 4 then
send_photo(get_receiver(msg), "pictures/cats/cat4.jpg", ok_cb, false) send_photo(get_receiver(msg), "pictures/cats/cat4.jpg", ok_cb, false)
end end
end
end end
return { return {

View File

@ -28,7 +28,7 @@ function run(msg, matches)
local title = getTitle(result) local title = getTitle(result)
-- We don't want 301 (and one Extrawurst for Google), 302, 404 and empty titles -- We don't want 301 (and one Extrawurst for Google), 302, 404 and empty titles
if title == "301 Moved Permanently" or title == "" or title == "404 Not Found" or title == "302 Found" or title == "Moved Permanently" then if title == "301 Moved Permanently" or title == "" or title == "404 Not Found" or title == "302 Found" or title == "Moved Permanently" or string.match(title, "DeviantArt") then
print('Invalide, da "'..title..'"') print('Invalide, da "'..title..'"')
else else
return title return title