]> git.lizzy.rs Git - furrybot-discord.git/commitdiff
Make bot ping proof
authorElias Fleckenstein <eliasfleckenstein@web.de>
Sat, 5 Mar 2022 20:58:08 +0000 (21:58 +0100)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Sat, 5 Mar 2022 20:58:08 +0000 (21:58 +0100)
basic.js
common.js
init.js
nsfw.js [new file with mode: 0644]
nsfw.lua [deleted file]

index 0ef4f4607d209c4ecd443ce36fdce8a0356241df..e4b5e6445555eb1d786400d0bb61c0be0d7162f4 100644 (file)
--- a/basic.js
+++ b/basic.js
@@ -1,8 +1,12 @@
+const common = require("./common.js")
+
 module.exports = {
        help: {
                params: "[<command>]",
                help: "Display help for a commands or show list of available commands",
                func: (msg, [cmd], {commands}) => {
+                       cmd = cmd && common.stripPings(cmd)
+                       
                        if (cmd) {
                                let def = commands[cmd]
 
index 4e950e67e06c514032742c3261d9a94bda105689..17563879c29a97933bf503aca600e09644598022 100644 (file)
--- a/common.js
+++ b/common.js
@@ -101,3 +101,9 @@ module.exports.listChangeCommand = (action, list, status) => new Object({
                }
        }
 })
+
+module.exports.stripPings = str => str
+       .replace(/<@!/g, "<@​!")
+       .replace(/<@&/g, "<@​&")
+       .replace(/@here/g, "@​here")
+       .replace(/@everyone/g, "@​everyone")
diff --git a/init.js b/init.js
index 9bbc3156836d660b15d23f70fc601befb43abc31..b9fc2e67be53b778ae2a071e3f9c8ca61f91d29a 100644 (file)
--- a/init.js
+++ b/init.js
@@ -17,7 +17,7 @@ let fb = {
 client.on("messageCreate", msg => {
        if (msg.author.id != client.user.id && msg.content.startsWith("!") && !fb.ignored[msg.author.id]) {
                let args = msg.content.slice(1).split(" ")
-               let cmd = args.shift()
+               let cmd = common.stripPings(args.shift())
                let def = fb.commands[cmd]
 
                if (def) {
@@ -31,8 +31,8 @@ client.on("messageCreate", msg => {
        }
 })
 
-//const modules = ["nsfw", "random"]
-const modules = ["basic", "bullshit", "marriage", "http", "roleplay", "death", "economy", "waifu", "operator"]
+//const modules = ["random"]
+const modules = ["basic", "bullshit", "marriage", "http", "roleplay", "death", "economy", "waifu", "operator", "nsfw"]
 
 for (let f of modules) {
        let m = require(`./${f}.js`)
diff --git a/nsfw.js b/nsfw.js
new file mode 100644 (file)
index 0000000..ee52177
--- /dev/null
+++ b/nsfw.js
@@ -0,0 +1,59 @@
+const pseudoRandom = require("pseudo-random")
+const common = require("./common.js")
+
+const asciiGenital = (id, begin, middle, ending) => 
+       begin + middle.repeat(2 + Math.floor(pseudoRandom(id).random() * (10 - 2 + 1))) + ending
+
+const asciiDick = id => asciiGenital(id + 1, "8", "=", "D")
+const asciiBoob = id => asciiGenital(id + 2, "E", "Ξ", "3")
+
+module.exports = {
+       dicksize: {
+               params: "[<player>]",
+               help: "Display the size of your own or another users's dick",
+               func: (msg, [targetPing]) => {
+                       const target = targetPing ? common.getPing(targetPing) : msg.author.id
+
+                       if (target)
+                               msg.reply(`${asciiDick(target)}    ← <@!${targe}>'s Dick'`)
+               }
+       },
+       boobsize: {
+               params: "[<player>]",
+               help: "Display the size of your own or another users's boobs",
+               func: (msg, [targetPing]) => {
+                       const target = targetPing ? common.getPing(targetPing) : msg.author.id
+
+                       if (target)
+                               msg.reply(`${asciiBoob(target)}    ← <@!${targe}>'s Boobs'`)
+               }
+       },
+}
+
+/*
+
+furrybot.request_command("smellfeet", "smell another player's feet", function(name, target)
+       furrybot.ping_message(target, name .. " wants to smell your feet. Type !accept to accept or !deny to deny.", furrybot.colors.system)
+end, function(name, target)
+       furrybot.ping_message(name, " you are smelling " .. target .. "'s feet. They are kinda stinky!", furrybot.colors.roleplay)
+end)
+
+furrybot.request_command("blowjob", "suck another player's dick", function(name, target)
+       furrybot.ping_message(target, name .. " wants to suck your dick. Type !accept to accept or !deny to deny.", furrybot.colors.system)
+end, function(name, target)
+       furrybot.send(name .. " is sucking " .. target .. "'s cock. " .. furrybot.get_ascii_dick(target) .. " ˣoˣ ", furrybot.colors.roleplay)
+end)
+
+furrybot.request_command("sex", "have sex with another player", function(name, target)
+       furrybot.ping_message(target, name .. " wants to have sex with you. Type !accept to accept or !deny to deny.", furrybot.colors.system)
+end, function(name, target)
+       furrybot.send(name .. " and " .. target .. " are having sex! OwO", furrybot.colors.roleplay)
+end)
+
+furrybot.commands.cum = {
+       help = "Cum",
+       func = function(name)
+               furrybot.send(name .. " is cumming: " .. furrybot.get_ascii_dick(name) .. C("#FFFFFF") .. furrybot.repeat_string("~", math.random(1, 10)), furrybot.colors.roleplay)
+       end
+}
+*/
diff --git a/nsfw.lua b/nsfw.lua
deleted file mode 100644 (file)
index 1bbad7e..0000000
--- a/nsfw.lua
+++ /dev/null
@@ -1,61 +0,0 @@
-local http, env, storage
-local C = minetest.get_color_escape_sequence
-
-function furrybot.get_ascii_genitals(name, begin, middle, ending, seed)
-       return begin .. furrybot.repeat_string(middle, furrybot.strrandom(name, seed, 2, 10)) .. ending
-end
-
-function furrybot.get_ascii_dick(name)
-       return minetest.rainbow(furrybot.get_ascii_genitals(name, "8", "=", "D", 31242))
-end
-
-function furrybot.get_ascii_boobs(name)
-       return furrybot.get_ascii_genitals(name, "E", "Ξ", "3", 31243)
-end
-
-furrybot.commands.dicksize = {
-       params = "[<player>]",
-       help = "Display the size of your own or another player's dick",
-       func = function(name, target)
-               target = target or name
-               furrybot.send(furrybot.get_ascii_dick(target) .. furrybot.colors.system .. "   ← " .. furrybot.ping(target, furrybot.colors.system) .. "'s Dick", furrybot.colors.system)
-       end,
-}
-
-furrybot.commands.boobsize = {
-       params = "[<player>]",
-       help = "Display the size of your own or another player's boobs",
-       func = function(name, target)
-               target = target or name
-               furrybot.send(furrybot.get_ascii_boobs(target) .. furrybot.colors.system .. "   ← " .. furrybot.ping(target, furrybot.colors.system) .. "'s Boobs", furrybot.colors.system)
-       end,
-}
-
-furrybot.request_command("smellfeet", "smell another player's feet", function(name, target)
-       furrybot.ping_message(target, name .. " wants to smell your feet. Type !accept to accept or !deny to deny.", furrybot.colors.system)
-end, function(name, target)
-       furrybot.ping_message(name, " you are smelling " .. target .. "'s feet. They are kinda stinky!", furrybot.colors.roleplay)
-end)
-
-furrybot.request_command("blowjob", "suck another player's dick", function(name, target)
-       furrybot.ping_message(target, name .. " wants to suck your dick. Type !accept to accept or !deny to deny.", furrybot.colors.system)
-end, function(name, target)
-       furrybot.send(name .. " is sucking " .. target .. "'s cock. " .. furrybot.get_ascii_dick(target) .. " ˣoˣ ", furrybot.colors.roleplay)
-end)
-
-furrybot.request_command("sex", "have sex with another player", function(name, target)
-       furrybot.ping_message(target, name .. " wants to have sex with you. Type !accept to accept or !deny to deny.", furrybot.colors.system)
-end, function(name, target)
-       furrybot.send(name .. " and " .. target .. " are having sex! OwO", furrybot.colors.roleplay)
-end)
-
-furrybot.commands.cum = {
-       help = "Cum",
-       func = function(name)
-               furrybot.send(name .. " is cumming: " .. furrybot.get_ascii_dick(name) .. C("#FFFFFF") .. furrybot.repeat_string("~", math.random(1, 10)), furrybot.colors.roleplay)
-       end
-}
-
-return function(_http, _env, _storage)
-       http, env, storage = _http, _env, _storage
-end