diff --git a/cmds_SharpBot/Fun/leet.js b/cmds_SharpBot/Fun/leet.js index 0419431..e8b6bfd 100644 --- a/cmds_SharpBot/Fun/leet.js +++ b/cmds_SharpBot/Fun/leet.js @@ -21,7 +21,7 @@ const getInverseReplacements = replacements => { }; exports.run = function (bot, message, args) { - const parsedArgs = bot.utils.parseArgs(args, ['e', 't']); + const parsedArgs = client.parseArgs(args, ['e', 't']); if (parsedArgs.leftover.length < 1) { throw 'Provide text to be leeted.'; diff --git a/commands/Fun/clap.js b/commands/Fun/clap.js index 55bd925..59347c0 100644 --- a/commands/Fun/clap.js +++ b/commands/Fun/clap.js @@ -5,7 +5,7 @@ exports.run = async (client, message, args, level) => { message.delete(); return (await message.channel.send("Please provide some text to clapify")).delete(5000); } - + message.delete(); message.channel.send(args.map(randomizeCase).join(':clap:')); }; diff --git a/commands/Fun/color.js b/commands/Fun/color.js deleted file mode 100644 index a702e87..0000000 --- a/commands/Fun/color.js +++ /dev/null @@ -1,22 +0,0 @@ -exports.run = async (client, message, args, level) => { - const response = await client.awaitReply(message, "Hey, what's your favorite color?"); - if(response !== "black") { - message.reply(`Oh, I really love ${response} too!`); - } else { - message.reply(`you like ${response}? Disgusting.`); - } -} - -exports.conf = { - enabled: true, - guildOnly: false, - aliases: [], - permLevel: "User" -}; - -exports.help = { - name: "color", - category: "Fun", - description: "Who likes a color?", - usage: "color" -}; \ No newline at end of file diff --git a/commands/Fun/fanceh.js b/commands/Fun/fanceh.js index 8b3128d..29594b0 100644 --- a/commands/Fun/fanceh.js +++ b/commands/Fun/fanceh.js @@ -25,7 +25,7 @@ exports.run = async (client, message, args, level) => { message.delete(); return (await message.reply("Please specify something to ask of the magic 8-ball!")).delete(5000); } - + message.delete(); message.channel.send( args.join(' ') .split('') diff --git a/commands/Fun/talk.js b/commands/Fun/talk.js index f6c446f..21145fc 100644 --- a/commands/Fun/talk.js +++ b/commands/Fun/talk.js @@ -5,7 +5,7 @@ exports.run = async (client, message, args) => { await message.delete(); if(args.length == 0) - return message.reply("Please insert a valid message.") + return message.reply("please insert a valid message.") .then(msg => { msg.delete(5000).catch(e => {e}) }) diff --git a/commands/_base.js b/commands/_base.js index 2eb42a7..a828074 100644 --- a/commands/_base.js +++ b/commands/_base.js @@ -18,4 +18,13 @@ exports.help = { usage: "" }; +*/ + +/* Basic message auto-deletion + +if (!args[0]) { + message.delete(); + return (await message.reply("text")).delete(5000); +} + */ \ No newline at end of file diff --git a/modules/functions.js b/modules/functions.js index 1a4d1f2..7bc537b 100644 --- a/modules/functions.js +++ b/modules/functions.js @@ -154,6 +154,8 @@ module.exports = (client) => { client.wait = require("util").promisify(setTimeout); + client.randomSelection = choices => choices[Math.floor(Math.random() * choices.length)]; + process.on("uncaughtException", (err) => { const errorMsg = err.stack.replace(new RegExp(`${__dirname}/`, "g"), "./"); client.logger.error(`Uncaught Exception: ${errorMsg}`); @@ -363,4 +365,6 @@ module.exports = (client) => { } }); }; + + client.quoteRegex = input => `${input}`.replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&'); }; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 31d6bd8..681aaa2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -608,6 +608,11 @@ "signal-exit": "^3.0.2" } }, + "roll": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/roll/-/roll-1.2.0.tgz", + "integrity": "sha1-9LlQUZBpVXOe0+8ACkE5VaqwaiI=" + }, "run-async": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", diff --git a/package.json b/package.json index f2a8a1c..690c5e2 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "moment": "^2.24.0", "moment-duration-format": "^2.3.2", "recrawl": "^2.0.0", + "roll": "^1.2.0", "webdict": "^0.3.0" }, "publishConfig": {