Skip to content
This repository has been archived by the owner on Oct 14, 2018. It is now read-only.

boobs.lua: accept parameters #276

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
43 changes: 29 additions & 14 deletions plugins/boobs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,33 +38,48 @@ local function getRandomBoobs(attempt)
end

local function run(msg, matches)
local url = nil
local n = string.match(matches[1], '[0-9]+')

if matches[1] == "!boobs" then
url = getRandomBoobs()
end
if n ~= nil then
if tonumber(n) <= 20 then
req = match_pattern("^![bosut]+", matches[1])
for i = 1,n do run(msg, req) end
else
return "Too many pictures requested. Maximum 20 allowed."
end
else
local url = nil

if matches[1] == "!boobs" then
url = getRandomBoobs()
end

if matches[1] == "!butts" then
url = getRandomButts()
end
if matches[1] == "!butts" then
url = getRandomButts()
end

if url ~= nil then
local receiver = get_receiver(msg)
send_photo_from_url(receiver, url)
else
return 'Error getting boobs/butts for you, please try again later.'
if url ~= nil then
local receiver = get_receiver(msg)
send_photo_from_url(receiver, url)
else
return 'Error getting boobs/butts for you, please try again later.'
end
end
end

return {
description = "Gets a random boobs or butts pic",
usage = {
"!boobs: Get a boobs NSFW image. 🔞",
"!butts: Get a butts NSFW image. 🔞"
"!boobs N: Get N boobs NSFW images. 🔞",
"!butts: Get a butts NSFW image. 🔞",
"!butts N: Get N butts NSFW images. 🔞",
},
patterns = {
"^!boobs$",
"^!butts$"
"^!butts$",
"^!boobs [0-9]+$",
"^!butts [0-9]+$"
},
run = run
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/danbooru.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ local function run(msg, matches)
txt = txt .. 'Character: ' .. post.tag_string_character .. '\n'
end
if post.file_size ~= '' then
txt = txt .. '[' .. math.ceil(post.file_size/1000) .. 'kb] ' .. URL .. post.file_url
txt = txt .. '[' .. math.ceil(post.file_size/1000) .. 'kb] '-- .. URL .. post.file_url
end
return txt
end
Expand All @@ -71,4 +71,4 @@ return {
run = run
}

end
end
2 changes: 1 addition & 1 deletion tg