Butts bugfix

This commit is contained in:
yago 2015-03-08 22:11:00 +01:00
parent 9c2582f627
commit 8bb1a19cfc

View File

@ -1,7 +1,7 @@
do do
function getRandomButts(attempt) function getRandomButts(attempt)
attempt = attempt or 0; attempt = attempt or 0
attempt = attempt + 1 attempt = attempt + 1
local res,status = http.request("http://api.obutts.ru/noise/1") local res,status = http.request("http://api.obutts.ru/noise/1")
@ -11,15 +11,15 @@ function getRandomButts(attempt)
-- The OpenBoobs API sometimes returns an empty array -- The OpenBoobs API sometimes returns an empty array
if not data and attempt < 10 then if not data and attempt < 10 then
print('Cannot get that boobs, trying another ones...') print('Cannot get that butts, trying another ones...')
return getRandomBoobs(attempt) return getRandomButts(attempt)
end end
return 'http://media.obutts.ru/' .. data.preview return 'http://media.obutts.ru/' .. data.preview
end end
function getRandomBoobs(attempt) function getRandomBoobs(attempt)
attempt = attempt or 0; attempt = attempt or 0
attempt = attempt + 1 attempt = attempt + 1
local res,status = http.request("http://api.oboobs.ru/noise/1") local res,status = http.request("http://api.oboobs.ru/noise/1")
@ -39,11 +39,11 @@ end
function run(msg, matches) function run(msg, matches)
local url = nil local url = nil
if matches[1] == "^!boobs" then if matches[1] == "!boobs" then
url = getRandomBoobs() url = getRandomBoobs()
end end
if matches[1] == "!buts" then if matches[1] == "!butts" then
url = getRandomButts() url = getRandomButts()
end end
@ -51,7 +51,7 @@ function run(msg, matches)
local receiver = get_receiver(msg) local receiver = get_receiver(msg)
send_photo_from_url(receiver, url) send_photo_from_url(receiver, url)
else else
return 'Error getting boobs for you, please try again later.' return 'Error getting boobs/butts for you, please try again later.'
end end
end end
@ -59,8 +59,8 @@ return {
description = "Gets a random boobs pic", description = "Gets a random boobs pic",
usage = "!boobs", usage = "!boobs",
patterns = { patterns = {
"^!boobs", "^!boobs$",
"^!buts" "^!butts$"
}, },
run = run run = run
} }