aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2022-03-06 14:09:38 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2022-03-06 14:09:38 +0100
commit407a6f66daebca35fb355ead2c0dc65e7c80fc68 (patch)
treed825cb12858027e0affccff01d3cde4c92021ab2
parent34d0cf9d14647c088a2683153b92c7d72bb21614 (diff)
downloadfurrybot-discord-407a6f66daebca35fb355ead2c0dc65e7c80fc68.tar.xz
Fully ping proof
-rw-r--r--basic.js2
-rw-r--r--common.js6
-rw-r--r--init.js7
-rw-r--r--random.js (renamed from random.lua)19
4 files changed, 17 insertions, 17 deletions
diff --git a/basic.js b/basic.js
index 6c45b04..f34f8bb 100644
--- a/basic.js
+++ b/basic.js
@@ -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]
diff --git a/common.js b/common.js
index d06566d..5bb4cff 100644
--- a/common.js
+++ b/common.js
@@ -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, "\@")
diff --git a/init.js b/init.js
index b9fc2e6..da34ff0 100644
--- a/init.js
+++ b/init.js
@@ -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`)
diff --git a/random.lua b/random.js
index aad94eb..11c387e 100644
--- a/random.lua
+++ b/random.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
+*/