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.recieve(msg)
22 msg = minetest.strip_colors(msg)
23 if msg:find("<") == 1 then
24 local idx = msg:find(">")
25 local player = msg:sub(2, idx - 1)
26 local message = msg:sub(idx + 3, #msg)
27 if message:find("!") == 1 then
28 local args = message:sub(2, #message):split(" ")
29 local cmd = table.remove(args, 1)
30 local func = furrybot.commands[cmd]
32 func(player, unpack(args))
34 furrybot.ping_player_error(player, "Invalid command", cmd)
40 function furrybot.player_online(name)
41 for _, n in ipairs(minetest.get_player_names()) do
48 function furrybot.check_online(name, target)
50 furrybot.ping_player_error(name, "You need to specify a player")
51 elseif name == target then
52 furrybot.ping_player_error(name, "You need to specify a different player than yourself")
53 elseif furrybot.player_online(target) then
56 furrybot.ping_player_error(name, "Player not online", target)
60 function furrybot.choose(list)
61 return list[math.random(#list)]
64 function furrybot.http_request(url, name, callback)
65 furrybot.http.fetch({url = url}, function(res)
69 furrybot.ping_player_error(name, "Request failed with code", res.code)
74 function furrybot.json_http_request(url, name, callback)
75 furrybot.http_request(url, name, function(raw)
76 local data = minetest.parse_json(raw)
77 callback(data[1] or data)
81 function furrybot.rand(str, seed, ...)
83 local pr = PseudoRandom(seed)
85 v = v + str:byte(i) * pr:next()
87 return PseudoRandom(v):next(...)
92 function furrybot.commands.hug(name, target)
93 if furrybot.check_online(name, target) then
94 furrybot.send(name .. " hugs " .. target .. ".")
98 furrybot.commands.cuddle = furrybot.commands.hug
100 function furrybot.commands.kiss(name, target)
101 if furrybot.check_online(name, target) then
102 furrybot.send(name .. " kisses " .. target .. ".")
106 furrybot.target_list = {}
108 function furrybot.commands.bang(name, target)
109 if furrybot.check_online(name, target) then
110 furrybot.target_list[target] = function()
111 furrybot.send(ping(name) .. " and " .. ping(target) .. " are having sex! OwO")
113 furrybot.ping_player(target, name .. " wants to have sex with you. Type !accept to accept or !deny to deny.")
117 furrybot.commands.sex = furrybot.commands.bang
118 furrybot.commands.fuck = furrybot.commands.bang
120 function furrybot.commands.accept(name)
121 local func = furrybot.target_list[name]
125 furrybot.ping_player_error(name, "Nothing to accept")
129 function furrybot.commands.deny(name)
130 if furrybot.target_list[name] then
131 furrybot.target_list[name] = nil
132 furrybot.ping_player(name, "Denied request")
134 furrybot.ping_player_error(name, "Nothing to deny")
138 function furrybot.commands.hit(name, target)
139 if furrybot.check_online(name, target) then
140 furrybot.send(name .. " hits " .. target)
144 furrybot.commands.slap = furrybot.commands.hit
145 furrybot.commands.beat = furrybot.commands.hit
147 function furrybot.commands.help()
149 for k in pairs(furrybot.commands) do
150 table.insert(keys, k)
152 furrybot.send("Available commands: " .. table.concat(keys, ", "))
155 function furrybot.commands.verse(name)
156 furrybot.json_http_request("https://labs.bible.org/api/?type=json&passage=random", name, function(data)
157 furrybot.send(data.text .. C("#00FFC3") .. "[" .. data.bookname .. " " .. data.chapter .. "," .. data.verse .. "]")
161 function furrybot.commands.define(name, word)
163 furrybot.json_http_request("https://api.dictionaryapi.dev/api/v1/entries/en_US/" .. word, name, function(data)
164 local meaning = data.meaning
165 local selected = meaning.exclamation or meaning.noun or meaning.verb or meaning.adjective or meaning["transitive verb"] or meaning.adverb or meaning["relative adverb"]
168 furrybot.ping_player_error(name, "Error in parsing response")
170 furrybot.send(C("#00FFC3") .. word:sub(1, 1):upper() .. word:sub(2, #word):lower() .. ": " .. C("#FFFA00") .. selected[1].definition)
174 furrybot.ping_player_error(name, "You need to specify a word")
178 function furrybot.commands.insult(name, target)
179 if furrybot.check_online(name, target) then
180 furrybot.http_request("https://insult.mattbas.org/api/insult", name, function(data)
181 furrybot.ping_player(target, data)
186 function furrybot.commands.rolldice(name)
187 furrybot.ping_player(name, "rolled a dice and got a " .. C("#AAFF43") .. math.random(6))
190 function furrybot.commands.coinflip(name)
191 furrybot.ping_player(name, "flipped a coin and got " .. C("#AAFF43") .. furrybot.choose({"Heads", "Tails"}))
194 function furrybot.commands.status()
197 function furrybot.commands.cmd()
200 function furrybot.commands.cocksize(name, target)
201 target = target or name
202 local msg = C("#FF4DE1")
203 local size = furrybot.rand(target, 31242, 2, 10)
208 furrybot.send(msg .. C("#FFFA00") .. " <= " .. furrybot.ping(target) .. "'s Cock")
211 furrybot.commands.dicksize = furrybot.commands.cocksize
213 function furrybot.commands.joke(name, first, last)
218 furrybot.json_http_request("http://api.icndb.com/jokes/random?firstName=" .. first .. "&lastName=" .. (last or ""), name, function(data)
219 local joke = data.value.joke:gsub(""", "\""):gsub(" ", " ")
224 if furrybot.loaded then
225 furrybot.send("Reloaded")
227 furrybot.loaded = true