3 local C = minetest.get_color_escape_sequence
5 function furrybot.send(msg, color)
6 minetest.send_chat_message("/me " .. C("#00FF3C") .. "[" .. C(color or "#FFFA00") .. msg .. C("#00FF3C") .. "]")
9 function furrybot.ping(player)
10 return C("#00DCFF") .. "@" .. player .. C("#FFFA00")
13 function furrybot.ping_player(player, message)
14 furrybot.send(furrybot.ping(player) .. ": " .. message)
17 function furrybot.ping_player_error(player, err, detail)
18 furrybot.ping_player(player, C("#D70029") .. " " .. err .. " " .. (detail and C("#FF6683") .. "'" .. detail .. "'" .. C("#D70029") or "") .. ".")
21 function furrybot.player_online(name)
22 for _, n in ipairs(minetest.get_player_names()) do
29 function furrybot.check_online(name, target)
30 if name == target then
31 furrybot.ping_player_error(name, "You need to specify another player")
32 elseif furrybot.player_online(target) then
35 furrybot.ping_player_error(name, "Player not online", target)
39 function furrybot.choose(list)
40 return list[math.random(#list)]
43 function furrybot.recieve(msg)
44 msg = minetest.strip_colors(msg)
45 if msg:find("<") == 1 then
46 local idx = msg:find(">")
47 local player = msg:sub(2, idx - 1)
48 local message = msg:sub(idx + 3, #msg)
49 if message:find("!") == 1 then
50 local args = message:sub(2, #message):split(" ")
51 local cmd = table.remove(args, 1)
52 local func = furrybot.commands[cmd]
54 func(player, unpack(args))
56 furrybot.ping_player_error(player, "Invalid command", cmd)
62 function furrybot.commands.hug(name, target)
63 if furrybot.check_online(name, target) then
64 furrybot.send(name .. " hugs " .. target .. ".")
68 furrybot.commands.cuddle = furrybot.commands.hug
70 function furrybot.commands.kiss(name, target)
71 if furrybot.check_online(name, target) then
72 furrybot.send(name .. " kisses " .. target .. ".")
76 furrybot.target_list = {}
78 function furrybot.commands.bang(name, target)
79 if furrybot.check_online(name, target) then
80 furrybot.target_list[target] = function()
81 furrybot.send(ping(name) .. " and " .. ping(target) .. " are having sex! OwO")
83 furrybot.ping_player(target, name .. " wants to have sex with you. Type !accept to accept or !deny to deny.")
87 furrybot.commands.sex = furrybot.commands.bang
88 furrybot.commands.fuck = furrybot.commands.bang
90 function furrybot.commands.accept(name)
91 local func = furrybot.target_list[name]
95 furrybot.ping_player_error(name, "Nothing to accept")
99 function furrybot.commands.deny(name)
100 if furrybot.target_list[name] then
101 furrybot.target_list[name] = nil
102 furrybot.ping_player(name, "Denied request")
104 furrybot.ping_player_error(name, "Nothing to deny")
108 function furrybot.commands.hit(name, target)
109 if furrybot.check_online(name, target) then
110 furrybot.send(name .. " hits " .. target)
114 furrybot.commands.slap = furrybot.commands.hit
115 furrybot.commands.beat = furrybot.commands.hit
117 function furrybot.commands.help()
119 for k in pairs(furrybot.commands) do
120 table.insert(keys, k)
122 furrybot.send("Available commands: " .. table.concat(keys, ", "))
125 function furrybot.commands.verse(name)
127 url = "https://labs.bible.org/api/?type=json&passage=random",
129 local res = furrybot.http.fetch(req, function(res)
130 if res.succeeded then
131 local data = minetest.parse_json(res.data)[1]
132 furrybot.send(data.text .. C("#00FFC3") .. "[" .. data.bookname .. " " .. data.chapter .. "," .. data.verse .. "]")
134 furrybot.ping_player_error(name, "Request failed with code", res.code)
139 function furrybot.commands.rolldice(name)
140 furrybot.ping_player(name, "rolled a dice and got a " .. C("#AAFF43") .. math.random(6))
143 function furrybot.commands.coinflip(name)
144 furrybot.ping_player(name, "flipped a coin and got " .. C("#AAFF43") .. furrybot.choose({"Heads", "Tails"}))
147 if furrybot.loaded then
148 furrybot.send("Reloaded")
150 furrybot.loaded = true