3 local C = minetest.get_color_escape_sequence
4 local http = minetest.get_http_api()
6 function furrybot.send(msg, color)
7 minetest.send_chat_message("/me " .. C("#00FF3C") .. "[" .. C(color or "#FFFA00") .. msg .. C("#00FF3C") .. "]")
10 function furrybot.ping(player)
11 return C("#00DCFF") .. "@" .. player .. C("#FFFA00")
14 function furrybot.ping_player(player, message)
15 furrybot.send(furrybot.ping(player) .. ": " .. message)
18 function furrybot.ping_player_error(player, err, detail)
19 furrybot.ping_player(player, C("#D70029") .. " " .. err .. " " .. (detail and C("#FF6683") .. "'" .. detail .. "'" .. C("#D70029") or "") .. ".")
22 function furrybot.player_online(name)
23 for _, n in ipairs(minetest.get_player_names()) do
30 function furrybot.check_online(name, target)
31 if name == target then
32 furrybot.ping_player_error(name, "You need to specify another player")
33 elseif furrybot.player_online(target) then
36 furrybot.ping_player_error(name, "Player not online", target)
40 function furrybot.recieve(msg)
41 msg = minetest.strip_colors(msg)
42 if msg:find("<") == 1 then
43 local idx = msg:find(">")
44 local player = msg:sub(2, idx - 1)
45 local message = msg:sub(idx + 3, #msg)
46 if message:find("!") == 1 then
47 local args = message:sub(2, #message):split(" ")
48 local cmd = table.remove(args, 1)
49 local func = furrybot.commands[cmd]
51 func(player, unpack(args))
53 furrybot.ping_player_error(player, "Invalid command", cmd)
59 function furrybot.commands.hug(name, target)
60 if furrybot.check_online(name, target) then
61 furrybot.send(name .. " hugs " .. target .. ".")
65 furrybot.commands.cuddle = furrybot.commands.hug
67 function furrybot.commands.kiss(name, target)
68 if furrybot.check_online(name, target) then
69 furrybot.send(name .. " kisses " .. target .. ".")
73 furrybot.target_list = {}
75 function furrybot.commands.bang(name, target)
76 if furrybot.check_online(name, target) then
77 furrybot.target_list[target] = function()
78 furrybot.send(ping(name) .. " and " .. ping(target) .. " are having sex! OwO")
80 furrybot.ping_player(target, name .. " wants to have sex with you. Type !accept to accept or !deny to deny.")
84 furrybot.commands.sex = furrybot.commands.bang
85 furrybot.commands.fuck = furrybot.commands.bang
87 function furrybot.commands.accept(name)
88 local func = furrybot.target_list[name]
92 furrybot.ping_player_error(name, "Nothing to accept")
96 function furrybot.commands.deny(name)
97 if furrybot.target_list[name] then
98 furrybot.target_list[name] = nil
99 furrybot.ping_player(name, "Denied request")
101 furrybot.ping_player_error(name, "Nothing to deny")
105 function furrybot.commands.hit(name, target)
106 if furrybot.check_online(name, target) then
107 furrybot.send(name .. " hits " .. target)
111 furrybot.commands.slap = furrybot.commands.hit
112 furrybot.commands.beat = furrybot.commands.hit
114 function furrybot.commands.help()
116 for k in pairs(furrybot.commands) do
117 table.insert(keys, k)
119 furrybot.send("Available commands: " .. table.concat(keys, ", "))
122 function furrybot.commands.verse(name)
124 url = "https://labs.bible.org/api/?type=json&passage=random",
126 local res = http.fetch_sync(req)
127 if res.succeeded then
128 local data = minetest.parse_json(res.data)[1]
129 furrybot.send(data.text .. C("#00FFC3") .. "[" .. data.bookname .. " " .. data.chapter .. "," .. data.verse .. "]")
131 furrybot.ping_player_error(name, "Request failed with code", res.code)
135 if furrybot.loaded then
136 furrybot.send("Reloaded")
138 furrybot.loaded = true