3 furrybot.unsafe_commands = {}
5 local http, env, storage
6 local C = minetest.get_color_escape_sequence
10 system = C("#FFFA00"),
12 detail = C("#FF6683"),
14 braces = C("#FFFAC0"),
17 random = C("#A300BE"),
23 function furrybot.send(msg, color)
24 minetest.send_chat_message("/me " .. furrybot.colors.braces .. "[" .. color .. msg .. furrybot.colors.braces .. "]")
27 function furrybot.ping(player, color)
28 return furrybot.colors.ping .. "@" .. player .. color
31 function furrybot.ping_message(player, message, color)
32 furrybot.send(furrybot.ping(player, color) .. ": " .. message, "")
35 function furrybot.error_message(player, error, detail)
36 furrybot.ping_message(player, error .. (detail and furrybot.colors.detail .. " '" .. detail .. "'" .. furrybot.colors.error or "") .. ".", furrybot.colors.error)
39 function furrybot.parse_message(player, message, discord)
40 if message:find("!") == 1 then
41 local args = message:sub(2, #message):split(" ")
42 local cmd = table.remove(args, 1)
43 local func = furrybot.commands[cmd]
45 if furrybot.unsafe_commands[cmd] and discord then
46 furrybot.error_message(player, "Sorry, you cannot run this command from discord: ", cmd)
48 func(player, unpack(args))
51 furrybot.error_message(player, "Invalid command", cmd)
56 function furrybot.reload()
57 local func, err = env.loadfile("clientmods/furrybot/bot.lua")
59 local old_fb = table.copy(furrybot)
60 local status, init = pcall(func)
62 init(http, env, storage)
65 return false, furrybot.colors.error .. "Error: " .. furrybot.colors.detail .. init
68 return false, furrybot.colors.error .. "Syntax error: " .. furrybot.colors.detail .. err
72 function furrybot.player_online(name)
73 for _, n in ipairs(minetest.get_player_names()) do
80 function furrybot.online_or_error(name, other, allow_self)
82 furrybot.error_message(name, "You need to specify a player")
83 elseif name == other and not allow_self then
84 furrybot.error_message(name, "You need to specify a different player than yourself")
85 elseif furrybot.player_online(other) then
88 furrybot.error_message(name, "Player not online", other)
92 function furrybot.choose(list, color)
93 return furrybot.colors.random .. list[math.random(#list)] .. color
96 function furrybot.random(min, max, color)
97 return furrybot.colors.random .. math.random(min, max) .. color
100 function furrybot.http_request(url, name, callback)
101 http.fetch({url = url}, function(res)
102 if res.succeeded then
105 furrybot.error_message(name, "Request failed with code", res.code)
110 function furrybot.json_http_request(url, name, callback)
111 furrybot.http_request(url, name, function(raw)
112 local data = minetest.parse_json(raw)
113 callback(data[1] or data)
117 function furrybot.strrandom(str, seed, ...)
119 local pr = PseudoRandom(seed)
121 v = v + str:byte(i) * pr:next()
123 return PseudoRandom(v):next(...)
126 function furrybot.repeat_string(str, times)
134 function furrybot.interactive_rpg_command(action)
135 return function(name, target)
136 if furrybot.online_or_error(name, target) then
137 furrybot.send(name .. " " .. action .. " " .. target .. ".", furrybot.colors.rpg)
142 function furrybot.solo_rpg_command(action)
143 return function(name)
144 furrybot.send(name .. " " .. action .. ".", furrybot.colors.rpg)
148 function furrybot.request_command(on_request, on_accept)
149 return function(name, target)
150 if furrybot.online_or_error(name, target) and on_request(name, target) ~= false then
151 furrybot.requests[target] = {
159 function furrybot.get_money(name)
160 local key = name .. ".money"
161 if storage:contains(key) then
162 return storage:get_int(key)
168 function furrybot.set_money(name, money)
169 storage:set_int(name .. ".money", money)
172 function furrybot.add_money(name, add)
173 local money = furrybot.get_money(name)
174 furrybot.set_money(name, money + add)
177 function furrybot.take_money(name, remove)
178 local money = furrybot.get_money(name)
179 local new = money - remove
183 furrybot.set_money(name, new)
188 function furrybot.money(money, color)
189 return furrybot.colors.money .. "$" .. money .. color
192 function furrybot.get_ascii_genitals(name, begin, middle, ending, seed)
193 return begin .. furrybot.repeat_string(middle, furrybot.strrandom(name, seed, 2, 10)) .. ending
196 function furrybot.get_ascii_dick(name)
197 return minetest.rainbow(furrybot.get_ascii_genitals(name, "8", "=", "D", 69))
200 function furrybot.get_ascii_boobs(name)
201 return furrybot.get_ascii_genitals(name, "E", "Ξ", "B", 420)
207 function furrybot.commands.help()
209 for k in pairs(furrybot.commands) do
210 table.insert(keys, k)
212 furrybot.send("Available commands: " .. table.concat(keys, ", "), furrybot.colors.system)
215 function furrybot.commands.accept(name)
216 local tbl = furrybot.requests[name]
218 furrybot.requests[name] = nil
219 tbl.func(tbl.origin, name)
221 furrybot.error_message(name, "Nothing to accept")
224 furrybot.unsafe_commands.accept = true
226 function furrybot.commands.deny(name)
227 local tbl = furrybot.requests[name]
229 furrybot.requests[name] = nil
230 furrybot.ping_message(name, "Denied request", furrybot.colors.system)
232 furrybot.error_message(name, "Nothing to deny")
235 furrybot.unsafe_commands.deny = true
237 -- don't bug players that are running ClamityBot commands from discord
238 function furrybot.commands.status()
241 function furrybot.commands.cmd()
245 furrybot.commands.cry = furrybot.solo_rpg_command("cries")
246 furrybot.commands.laugh = furrybot.solo_rpg_command("laughs")
247 furrybot.commands.confused = furrybot.solo_rpg_command("is confused")
248 furrybot.commands.smile = furrybot.solo_rpg_command("smiles")
249 furrybot.commands.hug = furrybot.interactive_rpg_command("hugs")
250 furrybot.commands.cuddle = furrybot.interactive_rpg_command("cuddles")
251 furrybot.commands.kiss = furrybot.interactive_rpg_command("kisses")
252 furrybot.commands.hit = furrybot.interactive_rpg_command("hits")
253 furrybot.commands.slap = furrybot.interactive_rpg_command("slaps")
254 furrybot.commands.beat = furrybot.interactive_rpg_command("beats")
255 furrybot.commands.lick = furrybot.interactive_rpg_command("licks")
257 furrybot.commands.smellfeet = furrybot.request_command(function(name, target)
258 furrybot.ping_message(target, name .. " wants to smell your feet. Type !accept to accept or !deny to deny.", furrybot.colors.system)
259 end, function(name, target)
260 furrybot.ping_message(name, " you are smelling " .. target .. "'s feet. They are kinda stinky!", furrybot.colors.rpg)
263 furrybot.commands.blowjob = furrybot.request_command(function(name, target)
264 furrybot.ping_message(target, name .. " wants to suck your dick. Type !accept to accept or !deny to deny.", furrybot.colors.system)
265 end, function(name, target)
266 furrybot.send(name .. " is sucking " .. target .. "'s cock. ˣoˣ IT'S SO HUGE", furrybot.colors.rpg)
269 furrybot.commands.sex = furrybot.request_command(function(name, target)
270 furrybot.ping_message(target, name .. " wants to have sex with you. Type !accept to accept or !deny to deny.", furrybot.colors.system)
271 end, function(name, target)
272 furrybot.send(name .. " and " .. target .. " are having sex! OwO", furrybot.colors.rpg)
274 furrybot.commands.bang = furrybot.commands.sex
275 furrybot.commands.fuck = furrybot.commands.sex
277 furrybot.commands.cum = function(name)
278 furrybot.send(name .. " is cumming: " .. furrybot.get_ascii_dick(name) .. C("#FFFFFF") .. furrybot.repeat_string("~", math.random(1, 10)), furrybot.colors.rpg)
281 furrybot.commands.marry = furrybot.request_command(function(name, target)
282 if storage:contains(name .. ".partner", target) then
283 furrybot.error_message(name, "You are already married to", storage:get_string(name .. ".partner"))
285 elseif storage:contains(target .. ".partner", name) then
286 furrybot.error_message(name, target .. " is already married to", storage:get_string(target .. ".partner"))
289 furrybot.ping_message(target, name .. " proposes to you. Type !accept to accept or !deny to deny.", furrybot.colors.system)
291 end, function(name, target)
292 storage:set_string(name .. ".partner", target)
293 storage:set_string(target .. ".partner", name)
294 furrybot.send("Congratulations, " .. furrybot.ping(name, furrybot.colors.rpg) .. "&" .. furrybot.ping(target, furrybot.colors.rpg) .. ", you are married. You may now kiss :).", furrybot.colors.rpg)
296 furrybot.commands.propose = furrybot.commands.marry
297 furrybot.unsafe_commands.marry = true
298 furrybot.unsafe_commands.propose = true
300 function furrybot.commands.divorce(name)
301 if storage:contains(name .. ".partner") then
302 local partner = storage:get_string(name .. ".partner")
303 storage:set_string(name .. ".partner", "")
304 storage:set_string(partner .. ".partner", "")
305 furrybot.ping_message(name, "divorces from " .. partner .. " :(", furrybot.colors.rpg)
307 furrybot.error_message(name, "You are not married")
310 furrybot.unsafe_commands.divorce = true
312 function furrybot.commands.partner(name, target)
313 target = target or name
314 if storage:contains(target .. ".partner") then
315 furrybot.ping_message(name, (target == name and "You are" or target .. " is") .. " married to " .. storage:get_string(target .. ".partner"), furrybot.colors.system)
317 furrybot.error_message(name, (target == name and "You are" or target .. " is") .. " not married")
320 furrybot.commands.married = furrybot.commands.partner
322 furrybot.kill_deathmessages = {
323 "%s walked into fire whilst fighting %s",
324 "%s was struck by lightning whilst fighting %s",
325 "%s was burnt to a crisp whilst fighting %s",
326 "%s tried to swim in lava to escape %s",
327 "%s walked into danger zone due to %s",
328 "%s suffocated in a wall whilst fighting %s",
329 "%s drowned whilst trying to escape %s",
330 "%s starved to death whilst fighting %s",
331 "%s walked into a cactus whilst trying to escape %s",
332 "%s hit the ground too hard whilst trying to escape %s",
333 "%s experienced kinetic energy whilst trying to escape %s",
334 "%s didn't want to live in the same world as %s",
335 "%s died because of %s",
336 "%s was killed by magic whilst trying to escape %s",
337 "%s was killed by %s using magic",
338 "%s was roasted in dragon breath by %s",
339 "%s withered away whilst fighting %s",
340 "%s was shot by a skull from %s",
341 "%s was squashed by a falling anvil whilst fighting %s",
342 "%s was slain by %s",
344 "%s was fireballed by %s",
345 "%s was killed trying to hurt %s",
346 "%s was blown up by %s",
347 "%s was squashed by %s",
350 furrybot.deathmessages = {
351 "%s went up in flames",
352 "%s was struck by lightning",
353 "%s burned to death",
354 "%s tried to swim in lava",
355 "%s discovered the floor was lava",
356 "%s suffocated in a wall",
358 "%s starved to death",
359 "%s was pricked to death",
360 "%s hit the ground too hard",
361 "%s experienced kinetic energy",
362 "%s fell out of the world",
364 "%s was killed by magic",
365 "%s was roasted in dragon breath",
367 "%s was squashed by a falling anvil",
369 "%s was squished too much",
370 "%s went off with a bang",
373 function furrybot.commands.kill(name, target)
374 if furrybot.online_or_error(name, target, true) then
375 if name == target then
376 furrybot.send(string.format("%s died due to lack of friends", target), furrybot.colors.rpg)
378 furrybot.send(string.format(furrybot.kill_deathmessages[math.random(#furrybot.kill_deathmessages)], target, name), furrybot.colors.rpg)
383 function furrybot.commands.die(name)
384 furrybot.send(string.format(furrybot.deathmessages[math.random(#furrybot.deathmessages)], name), furrybot.colors.rpg)
388 function furrybot.commands.rolldice(name)
389 furrybot.ping_message(name, "rolled a dice and got a " .. furrybot.random(1, 6, furrybot.colors.system) .. ".", furrybot.colors.system)
392 function furrybot.commands.coinflip(name)
393 furrybot.ping_message(name, "flipped a coin and got " .. furrybot.choose({"Heads", "Tails"}, furrybot.colors.system) .. ".", furrybot.colors.system)
396 function furrybot.commands.choose(name, ...)
397 local options = {...}
399 furrybot.ping_message(name, "I choose " .. furrybot.choose(options, "", furrybot.colors.system) .. ".", furrybot.colors.system)
401 furrybot.error_message(name, "Not enough options")
405 function furrybot.commands.dicksize(name, target)
406 target = target or name
407 furrybot.send(furrybot.get_ascii_dick(target) .. furrybot.colors.system .. " ← " .. furrybot.ping(target, furrybot.colors.system) .. "'s Dick", furrybot.colors.system)
409 furrybot.commands.cocksize = furrybot.commands.dicksize
411 function furrybot.commands.boobsize(name, target)
412 target = target or name
413 furrybot.send(furrybot.get_ascii_boobs(target) .. furrybot.colors.system .. " ← " .. furrybot.ping(target, furrybot.colors.system) .. "'s Boobs", furrybot.colors.system)
417 function furrybot.commands.amogus(name)
418 furrybot.ping_message(name, "YOU KINDA SUS MAN", furrybot.colors.fun)
421 function furrybot.commands.verse(name)
422 furrybot.json_http_request("https://labs.bible.org/api/?type=json&passage=random", name, function(data)
423 furrybot.send(data.text .. furrybot.colors.info .. "[" .. data.bookname .. " " .. data.chapter .. "," .. data.verse .. "]", furrybot.colors.fun)
427 function furrybot.commands.define(name, word)
429 furrybot.json_http_request("https://api.dictionaryapi.dev/api/v1/entries/en_US/" .. word:gsub("computer", "person"), name, function(data)
430 local meaning = data.meaning
431 local selected = meaning.abbreviation or meaning["cardinal number"] or meaning.exclamation or meaning.noun or meaning.verb or meaning.adjective or meaning["transitive verb"] or meaning.adverb or meaning["relative adverb"] or meaning.preposition
434 furrybot.error_message(name, "Error in parsing response")
436 furrybot.send(word:sub(1, 1):upper() .. word:sub(2, #word):lower() .. ": " .. furrybot.colors.fun .. selected[1].definition, furrybot.colors.info)
440 furrybot.error_message(name, "You need to specify a word")
444 function furrybot.commands.insult(name, target)
445 if furrybot.online_or_error(name, target, true) then
446 furrybot.http_request("https://insult.mattbas.org/api/insult", name, function(data)
447 furrybot.ping_message(target, data, furrybot.colors.fun)
452 function furrybot.commands.joke(name, first, last)
459 furrybot.json_http_request("http://api.icndb.com/jokes/random?firstName=" .. first .. "&lastName=" .. last, name, function(data)
460 local joke = data.value.joke:gsub(""", "\""):gsub(" ", " ")
461 furrybot.send(joke, furrybot.colors.fun)
465 function furrybot.commands.question(name)
466 furrybot.json_http_request("https://8ball.delegator.com/magic/JSON/anything", name, function(data)
467 furrybot.ping_message(name, data.magic.answer, furrybot.colors.fun)
470 furrybot.commands["8ball"] = furrybot.commands.question
473 function furrybot.commands.money(name, target)
474 target = target or name
475 furrybot.ping_message(name, (target == name and "You have " or target .. " has ") .. furrybot.money(furrybot.get_money(target), furrybot.colors.system) .. ".", furrybot.colors.system)
477 furrybot.commands.balance = furrybot.commands.money
479 function furrybot.commands.pay(name, target, number)
480 if furrybot.online_or_error(name, target) then
481 local money = tonumber(number or "")
482 if not money or money <= 0 or math.floor(money) ~= money then
483 furrybot.error_message(name, "Invalid amount of money")
485 if furrybot.take_money(name, money) then
486 furrybot.add_money(target, money)
487 furrybot.ping_message(target, name .. " has payed you " .. furrybot.money(money, furrybot.colors.system) .. ".", furrybot.colors.system)
489 furrybot.error_message(name, "You don't have enough money")
494 furrybot.unsafe_commands.pay = true
497 furrybot.send("FurryBot - " .. C("#170089") .. "https://github.com/EliasFleckenstein03/furrybot", furrybot.colors.system)
499 if furrybot.loaded then
500 furrybot.send("Reloaded", furrybot.colors.system)
502 furrybot.loaded = true
505 return function(_http, _env, _storage)
506 http, env, storage = _http, _env, _storage