milkE

text/x-lua

lua

4452

File milkE.lua

local lines = {
    legendary = {
        "me: drinking milk... someone: it's not milk... me: drinking NOT milk... someone: it's my... me: *quickened up...* ๐Ÿฅ› ๐Ÿฅ› ๐Ÿฅ› ๐Ÿ˜‹ ",
        "uhmmm... it's kind of my milk... do you like it? ๐Ÿฅ› ๐Ÿ˜ณ ",
        "\"i'm literally 'not milk'\" ๐Ÿฅ› Emotionless ",
        "average 'not milk' enjoyer ๐Ÿฅ› GIGACHAD ",
        "we are not 'born to die', does a cup of 'not milk' poured to finish immediately? ๐Ÿฅ› FeelsStrongMan ",
        "the cold cruelty of the universe when the indomitable 'not milk' spirit walks into the room: ๐Ÿฅ› WAITWAITWAIT " },
    epic = {
        "you drank the milk and it tastes like the milk from your childhood ๐Ÿฅ› ๐Ÿ‘ฉ ",
        "your lunch is here, commander... oh no, i forgot the milk! don't worry ๐Ÿฅ› ๐Ÿคจ ",
        "for every kill you get i'll give you a 'not milk' ... Alright bet ๐Ÿฅ› ๐Ÿ˜ณ ",
        "i may not show it but a cup of 'not milk' really be giving me renewed purpose in life ๐Ÿฅ› ๐Ÿ’ฏ ",
        "'why should i even keep drinking??' mfs when they look back at where they started to drink ๐Ÿฅ› ๐Ÿฅน",
        "when i am in a 'restoring faith in humanity' competition and my opponent is 'not milk' ๐Ÿฅ› OMAYGOT "
    },
    common = {
        "you are completely clueless of the contents of your drink ๐Ÿฅ› Clueless ",
        "linus milk tips ๐Ÿฅ› ๐Ÿค“ ",
        "bitches be like 'i am poly'... ok, do you want a 'not milk'? ๐Ÿฅ› ๐Ÿ’€ ",
        "he has 97 mental illnesses and is banned from most public spaces but he's your milk producer ๐Ÿฅ› BrorStirrer ",
        "'your gender is what's in your pants' ๐Ÿค“  alright, my gender is 'milk' ๐Ÿฅ› ๐Ÿ”ฅ ",
        "be the reason why someone continues to produce 'not milk' as the main purpose of their life",
        "it's alright - when i'm wearing a skirt... i'm a 'not milk' consumer ๐Ÿฅ› ๐Ÿ˜ณ ๐Ÿ‘‰ ๐Ÿ‘ˆ "
    },
    poor = {
        "you really got milk. real milk ๐Ÿฅ› ๐Ÿ˜” ",
        "haha!!! you just drank SULFURIC ACID!!! ๐Ÿฅ› โ˜  ",
        "average milk enjoyer ๐Ÿฅ› ๐Ÿ„ ๐Ÿค“ "
    }
}

local points_max = 10
local delay_sec = 150

function get_line(points)
    if points < 0 then
        return lines.poor[math.random(1, #lines.poor)]
    end

    local percent = (points / points_max) * 100;

    local category = {}

    if percent > 75 then
        category = lines.legendary
    elseif 45 <= percent and percent <= 75 then
        category = lines.epic
    else
        category = lines.common
    end

    return category[math.random(1, #category)]
end

-- !luaimport pastes:milkE --command !milk --global
-- !cmd new !milk !luaimport pastes:milkE

return function(request)
    local storage = storage_get()
    local now = time_current()
    local new = false

    if storage == "" then
        new = true
        storage = "{\"points\": 0, \"last_time\": " .. now .. "}"
    end

    local storage_contents = json_parse(storage)

    local difference_since_last_time = now - storage_contents.last_time

    if difference_since_last_time < delay_sec and not new then
        return request.sender.alias_name ..
            ": i am sorry, Master... but you have to wait " ..
            time_humanize(delay_sec - difference_since_last_time) .. " for me to pour you a milk ๐Ÿฅ› โœ‹"
    end

    storage_contents.last_time = now

    local points = 0
    local message = ""

    local fun = math.random(0, 100)

    if fun == 0 then
        points = -99
        message = "you were cursed with an intolerance to my milk ๐Ÿฅ› ๐Ÿ˜ญ"
    elseif 0 < fun and fun <= 49 then
        points = points + math.random(1, points_max)
        message = get_line(points)
    elseif 49 < fun and fun <= 79 then
        points = points - math.random(1, points_max)
        message = get_line(points)
    else
        points = 0
        message = "nothing found pls dont yell at me ๐Ÿฅบ ๐Ÿฅบ "
    end

    storage_contents.points = storage_contents.points + points

    storage_put(json_stringify(storage_contents))

    if points == 0 then
        return request.sender.alias_name .. ": " .. message .. " ..."
    end

    local points_formatted = ""

    if points > 0 then
        points_formatted = "+" .. points
    else
        points_formatted = tostring(points)
    end

    return request.sender.alias_name ..
        ": " .. message .. " ... anyways you got " .. points_formatted .. " | total: " .. storage_contents.points .. " ๐Ÿฅ›"
end

4.35 KB

text/x-lua (lua)

120 lines