diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2022-03-06 14:09:38 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2022-03-06 14:09:38 +0100 |
commit | 407a6f66daebca35fb355ead2c0dc65e7c80fc68 (patch) | |
tree | d825cb12858027e0affccff01d3cde4c92021ab2 | |
parent | 34d0cf9d14647c088a2683153b92c7d72bb21614 (diff) | |
download | furrybot-discord-407a6f66daebca35fb355ead2c0dc65e7c80fc68.tar.xz |
Fully ping proof
-rw-r--r-- | basic.js | 2 | ||||
-rw-r--r-- | common.js | 6 | ||||
-rw-r--r-- | init.js | 7 | ||||
-rw-r--r-- | random.js (renamed from random.lua) | 19 |
4 files changed, 17 insertions, 17 deletions
@@ -5,8 +5,6 @@ module.exports = { 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] @@ -2,8 +2,8 @@ const fs = require("fs") const google_images = require("free-google-images") const getPing = module.exports.getPing = (msg, ping, allowSelf) => { - if (ping && ping.startsWith("<@!") && ping.endsWith(">")) { - const id = ping.slice("<@!".length, -">".length) + if (ping && ping.startsWith("<\\@!") && ping.endsWith(">")) { + const id = ping.slice("<\\@!".length, -">".length) if (!allowSelf && id == msg.author.id) { msg.reply("Please mention a user other than yourself") @@ -104,5 +104,3 @@ module.exports.listChangeCommand = (action, list, status) => new Object({ } } }) - -module.exports.stripPings = str => str.replace(/@/g, "\@") @@ -16,8 +16,8 @@ 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 = common.stripPings(args.shift()) + let args = msg.content.replace(/@/g, "\\@").slice(1).split(" ") + let cmd = args.shift() let def = fb.commands[cmd] if (def) { @@ -31,8 +31,7 @@ client.on("messageCreate", msg => { } }) -//const modules = ["random"] -const modules = ["basic", "bullshit", "marriage", "http", "roleplay", "death", "economy", "waifu", "operator", "nsfw"] +const modules = ["basic", "bullshit", "marriage", "http", "roleplay", "death", "economy", "waifu", "operator", "nsfw", "random"] for (let f of modules) { let m = require(`./${f}.js`) @@ -1,6 +1,14 @@ -local http, env, storage -local C = minetest.get_color_escape_sequence - +const common = require("./common.js") + +module.exports = { + rolldice: { + func: msg => msg.channel.send(`<@!${msg.author.id}> rolled a dice and got a ${1 + Math.floor(Math.random() * 6)}.`) + }, + coinflip: { + func: msg => msg.channel.send(`<@!${msg.author.id}> flipped a coin and got ${common.choose(["Heads", "Tails"])}.`) + } +} +/* furrybot.commands.rolldice = { func = function(name) furrybot.ping_message(name, "rolled a dice and got a " .. furrybot.random(1, 6, furrybot.colors.system) .. ".", furrybot.colors.system) @@ -126,7 +134,4 @@ furrybot.commands.video = { furrybot.ping_message(name, "https://youtube.com/watch?v=dQw4w9WgXcQ", furrybot.colors.system) end, } - -return function(_http, _env, _storage) - http, env, storage = _http, _env, _storage -end +*/ |