From 3d225f654750c5bedaa8fccde624949849cb53b0 Mon Sep 17 00:00:00 2001 From: TheEssem Date: Mon, 2 Dec 2019 14:47:22 -0600 Subject: [PATCH] Added new help command and command metadata, various changes --- app.js | 2 +- commands/8ball.js | 46 +++++++++--------- commands/9gag.js | 4 +- commands/addtweet.js | 3 +- commands/avatar.js | 2 + commands/ban.js | 3 ++ commands/bandicam.js | 4 +- commands/bird.js | 2 + commands/blur.js | 5 +- commands/blurple.js | 4 +- commands/boat.js | 2 + commands/boi.js | 2 + commands/bruh.js | 2 + commands/bus.js | 2 + commands/cat.js | 3 +- commands/circle.js | 4 +- commands/cowsay.js | 100 ++++++++++++++++++++------------------- commands/dbl.js | 4 +- commands/decode.js | 2 + commands/deviantart.js | 4 +- commands/dice.js | 2 + commands/dog.js | 2 + commands/encode.js | 2 + commands/eval.js | 2 + commands/exec.js | 2 + commands/explode.js | 4 +- commands/explosion.js | 3 ++ commands/fakeping.js | 2 + commands/fart.js | 2 + commands/fbi.js | 2 + commands/feedback.js | 2 + commands/flip.js | 5 +- commands/flop.js | 4 +- commands/fortnite.js | 2 + commands/fullwidth.js | 2 + commands/funky.js | 4 +- commands/gamexplain.js | 6 ++- commands/haah.js | 4 +- commands/hackban.js | 6 ++- commands/help.js | 99 +++++++++++++++++++++++++++++++++++++- commands/hooh.js | 4 +- commands/hypercam.js | 4 +- commands/ifunny.js | 5 +- commands/image.js | 3 +- commands/implode.js | 4 +- commands/info.js | 6 ++- commands/invert.js | 4 +- commands/invite.js | 3 ++ commands/jpeg.js | 4 +- commands/kick.js | 3 ++ commands/leak.js | 6 ++- commands/lengthen.js | 3 +- commands/magik.js | 2 + commands/mail.js | 2 + commands/mc.js | 2 + commands/meme.js | 7 ++- commands/memecenter.js | 6 ++- commands/oof.js | 4 +- commands/ping.js | 2 + commands/play.js | 3 ++ commands/prefix.js | 2 + commands/prunejuice.js | 4 +- commands/purge.js | 4 +- commands/qrcreate.js | 5 +- commands/qrread.js | 7 ++- commands/reload.js | 5 +- commands/restart.js | 4 +- commands/retro.js | 7 ++- commands/rps.js | 4 +- commands/scott.js | 6 ++- commands/serverinfo.js | 4 +- commands/sharpen.js | 6 ++- commands/shorten.js | 4 +- commands/shutterstock.js | 6 ++- commands/snowflake.js | 4 +- commands/sonic.js | 7 ++- commands/spam.js | 5 +- commands/spin.js | 4 +- commands/stats.js | 4 +- commands/swirl.js | 4 +- commands/tags.js | 13 ++++- commands/tile.js | 4 +- commands/trump.js | 7 ++- commands/tweet.js | 2 + commands/userinfo.js | 4 +- commands/waaw.js | 5 +- commands/wall.js | 5 +- commands/wdt.js | 6 ++- commands/wikihow.js | 3 +- commands/winxp.js | 2 + commands/woow.js | 4 +- commands/xkcd.js | 9 ++-- commands/yoda.js | 4 +- commands/youtube.js | 3 +- utils/collections.js | 1 + utils/handler.js | 6 ++- utils/soundplayer.js | 3 -- 97 files changed, 456 insertions(+), 155 deletions(-) diff --git a/app.js b/app.js index aedce7b..67ed203 100644 --- a/app.js +++ b/app.js @@ -17,7 +17,7 @@ const handler = require("./utils/handler.js"); // registers stuff and logs in the bot async function init() { - // register commands + // register commands and their info const commands = await readdir("./commands/"); logger.log("info", `Attempting to load ${commands.length} commands...`); for (const commandFile of commands) { diff --git a/commands/8ball.js b/commands/8ball.js index 59da7b2..69e72e5 100644 --- a/commands/8ball.js +++ b/commands/8ball.js @@ -1,29 +1,31 @@ const { random } = require("../utils/misc.js"); +const responses = [ + "It is certain", + "It is decidedly so", + "Without a doubt", + "Yes, definitely", + "You may rely on it", + "As I see it, yes", + "Most likely", + "Outlook good", + "Yes", + "Signs point to yes", + "Reply hazy, try again", + "Ask again later", + "Better not tell you now", + "Cannot predict now", + "Concentrate and ask again", + "Don't count on it", + "My reply is no", + "My sources say no", + "Outlook not so good", + "Very doubtful" +]; exports.run = async () => { - const responses = [ - "It is certain", - "It is decidedly so", - "Without a doubt", - "Yes, definitely", - "You may rely on it", - "As I see it, yes", - "Most likely", - "Outlook good", - "Yes", - "Signs point to yes", - "Reply hazy, try again", - "Ask again later", - "Better not tell you now", - "Cannot predict now", - "Concentrate and ask again", - "Don't count on it", - "My reply is no", - "My sources say no", - "Outlook not so good", - "Very doubtful" - ]; return `🎱 ${random(responses)}`; }; exports.aliases = ["magicball", "magikball", "magic8ball", "magik8ball", "eightball"]; +exports.category = 4; +exports.help = "Asks the magic 8-ball a question"; \ No newline at end of file diff --git a/commands/9gag.js b/commands/9gag.js index feb4f7a..ec2b025 100644 --- a/commands/9gag.js +++ b/commands/9gag.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to add a 9GAG watermark!`; - message.channel.sendTyping(); const watermark = "./assets/images/9gag.png"; const data = gm(image.data).composite(watermark).gravity("East"); const resultBuffer = await gmToBuffer(data); @@ -17,3 +17,5 @@ exports.run = async (message) => { }; exports.aliases = ["ninegag", "gag"]; +exports.category = 5; +exports.help = "Adds the 9gag watermark to an image"; \ No newline at end of file diff --git a/commands/addtweet.js b/commands/addtweet.js index ddbe327..3abaf1e 100644 --- a/commands/addtweet.js +++ b/commands/addtweet.js @@ -11,5 +11,6 @@ exports.run = async (message, args) => { }; exports.aliases = ["add"]; - +exports.category = 7; +exports.help = "Adds a tweet to the database"; exports.requires = "twitter"; \ No newline at end of file diff --git a/commands/avatar.js b/commands/avatar.js index 6db09be..6d60024 100644 --- a/commands/avatar.js +++ b/commands/avatar.js @@ -11,3 +11,5 @@ exports.run = async (message, args) => { }; exports.aliases = ["pfp", "ava"]; +exports.category = 1; +exports.help = "Gets a user's avatar"; diff --git a/commands/ban.js b/commands/ban.js index 7e33615..d38c578 100644 --- a/commands/ban.js +++ b/commands/ban.js @@ -16,3 +16,6 @@ exports.run = async (message) => { return `${message.author.mention}, you need to provide a member to ban!`; } }; + +exports.category = 2; +exports.help = "Bans a server member"; \ No newline at end of file diff --git a/commands/bandicam.js b/commands/bandicam.js index 6cc8a15..e2d9296 100644 --- a/commands/bandicam.js +++ b/commands/bandicam.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Bandicam watermark!`; - message.channel.sendTyping(); const watermark = "./assets/images/bandicam.png"; gm(image.data).size(async (error, size) => { if (error) console.error; @@ -20,3 +20,5 @@ exports.run = async (message) => { }; exports.aliases = ["bandi"]; +exports.category = 5; +exports.help = "Adds the Bandicam watermark to an image"; \ No newline at end of file diff --git a/commands/bird.js b/commands/bird.js index 9f3ff60..e39585e 100644 --- a/commands/bird.js +++ b/commands/bird.js @@ -15,3 +15,5 @@ exports.run = async (message) => { }; exports.aliases = ["birb", "birds", "birbs"]; +exports.category = 4; +exports.help = "Gets a random bird picture"; \ No newline at end of file diff --git a/commands/blur.js b/commands/blur.js index 90e1ef9..a92fb67 100644 --- a/commands/blur.js +++ b/commands/blur.js @@ -1,12 +1,15 @@ const sharp = require("sharp"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to blur!`; - message.channel.sendTyping(); const resultBuffer = await sharp(image.data).blur(5).toBuffer(); return message.channel.createMessage("", { file: resultBuffer, name: `blur.${image.type}` }); }; + +exports.category = 5; +exports.help = "Blurs an image"; \ No newline at end of file diff --git a/commands/blurple.js b/commands/blurple.js index 4043d78..4188ed5 100644 --- a/commands/blurple.js +++ b/commands/blurple.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to make blurple!`; - message.channel.sendTyping(); const data = gm(image.data).threshold(75, true).out("+level-colors").out("\"#7289DA\",white"); const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { @@ -16,3 +16,5 @@ exports.run = async (message) => { }; exports.aliases = ["blurp"]; +exports.category = 5; +exports.help = "Turns an image blurple"; \ No newline at end of file diff --git a/commands/boat.js b/commands/boat.js index 06740ba..fbd8c39 100644 --- a/commands/boat.js +++ b/commands/boat.js @@ -5,3 +5,5 @@ exports.run = async (message) => { }; exports.aliases = ["tape", "flextape", "phil", "philswift"]; +exports.category = 6; +exports.help = "Plays the Flex Tape boat sound effect"; \ No newline at end of file diff --git a/commands/boi.js b/commands/boi.js index e46c3a9..bd033f9 100644 --- a/commands/boi.js +++ b/commands/boi.js @@ -5,3 +5,5 @@ exports.run = async (message) => { }; exports.aliases = ["boy", "neutron", "hugh"]; +exports.category = 6; +exports.help = "Plays the \"boi\" sound effect"; \ No newline at end of file diff --git a/commands/bruh.js b/commands/bruh.js index 84cb3ab..e165baa 100644 --- a/commands/bruh.js +++ b/commands/bruh.js @@ -5,3 +5,5 @@ exports.run = async (message) => { }; exports.aliases = ["bro"]; +exports.category = 6; +exports.help = "Plays the \"bruh\" sound effect"; \ No newline at end of file diff --git a/commands/bus.js b/commands/bus.js index cfc9d6c..06a24c6 100644 --- a/commands/bus.js +++ b/commands/bus.js @@ -5,3 +5,5 @@ exports.run = async (message) => { }; exports.aliases = ["noyelling", "busyell"]; +exports.category = 6; +exports.help = "Plays the \"no yelling on the bus\" sound effect"; \ No newline at end of file diff --git a/commands/cat.js b/commands/cat.js index acf941d..623d69e 100644 --- a/commands/cat.js +++ b/commands/cat.js @@ -19,5 +19,6 @@ exports.run = async (message) => { }; exports.aliases = ["kitters", "kitties", "kitty", "cattos", "catto", "cats"]; - +exports.category = 4; +exports.help = "Gets a random cat picture"; exports.requires = "cat"; \ No newline at end of file diff --git a/commands/circle.js b/commands/circle.js index de04789..60b5c01 100644 --- a/commands/circle.js +++ b/commands/circle.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to add radial blur!`; - message.channel.sendTyping(); const data = gm(image.data).out("-radial-blur", 10); const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { @@ -16,3 +16,5 @@ exports.run = async (message) => { }; exports.aliases = ["cblur", "radial", "radialblur"]; +exports.category = 5; +exports.help = "Applies a radial blur effect on an image"; \ No newline at end of file diff --git a/commands/cowsay.js b/commands/cowsay.js index b9734a9..9d12b7a 100644 --- a/commands/cowsay.js +++ b/commands/cowsay.js @@ -1,55 +1,55 @@ const cowsay = require("cowsay"); +const cowList = ["beavis.zen", + "bong", + "bud-frogs", + "bunny", + "cheese", + "cower", + "daemon", + "default", + "doge", + "dragon-and-cow", + "dragon", + "elephant-in-snake", + "elephant", + "eyes", + "flaming-sheep", + "ghostbusters", + "goat", + "hedgehog", + "hellokitty", + "kiss", + "kitty", + "koala", + "kosh", + "luke-koala", + "mech-and-cow", + "meow", + "milk", + "moofasa", + "moose", + "mutilated", + "ren", + "satanic", + "sheep", + "skeleton", + "small", + "squirrel", + "stegosaurus", + "stimpy", + "supermilker", + "surgery", + "telebears", + "turkey", + "turtle", + "tux", + "vader-koala", + "vader", + "whale", + "www" +]; exports.run = async (message, args) => { - const cowList = ["beavis.zen", - "bong", - "bud-frogs", - "bunny", - "cheese", - "cower", - "daemon", - "default", - "doge", - "dragon-and-cow", - "dragon", - "elephant-in-snake", - "elephant", - "eyes", - "flaming-sheep", - "ghostbusters", - "goat", - "hedgehog", - "hellokitty", - "kiss", - "kitty", - "koala", - "kosh", - "luke-koala", - "mech-and-cow", - "meow", - "milk", - "moofasa", - "moose", - "mutilated", - "ren", - "satanic", - "sheep", - "skeleton", - "small", - "squirrel", - "stegosaurus", - "stimpy", - "supermilker", - "surgery", - "telebears", - "turkey", - "turtle", - "tux", - "vader-koala", - "vader", - "whale", - "www" - ]; if (args.length === 0) { return `${message.author.mention}, you need to provide some text for the cow to say!`; } else if (cowList.includes(args[0].toLowerCase())) { @@ -64,3 +64,5 @@ exports.run = async (message, args) => { }; exports.aliases = ["cow"]; +exports.category = 4; +exports.help = "Makes an ASCII cow say a message"; diff --git a/commands/dbl.js b/commands/dbl.js index 99f1c65..9fdf784 100644 --- a/commands/dbl.js +++ b/commands/dbl.js @@ -1,5 +1,7 @@ exports.run = async (message) => { - return `${message.author.mention}, my DBL page can be found here: `; + return `${message.author.mention}, my DBL page can be found here: `; }; exports.aliases = ["discordbotlist", "botlist", "discordbots"]; +exports.category = 1; +exports.help = "Gets my top.gg page"; \ No newline at end of file diff --git a/commands/decode.js b/commands/decode.js index 12a8117..9a24419 100644 --- a/commands/decode.js +++ b/commands/decode.js @@ -4,3 +4,5 @@ exports.run = async (message, args) => { }; exports.aliases = ["b64decode", "base64decode"]; +exports.category = 1; +exports.help = "Decodes a Base64 string"; \ No newline at end of file diff --git a/commands/deviantart.js b/commands/deviantart.js index 6c88595..24ea32f 100644 --- a/commands/deviantart.js +++ b/commands/deviantart.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to add a DeviantArt watermark!`; - message.channel.sendTyping(); const watermark = "./assets/images/deviantart.png"; gm(image.data).size(async (error, size) => { if (error) console.error; @@ -20,3 +20,5 @@ exports.run = async (message) => { }; exports.aliases = ["da", "deviant"]; +exports.category = 5; +exports.help = "Adds a DeviantArt watermark to an image"; \ No newline at end of file diff --git a/commands/dice.js b/commands/dice.js index fa945b5..42ad316 100644 --- a/commands/dice.js +++ b/commands/dice.js @@ -13,3 +13,5 @@ exports.run = async (message, args) => { }; exports.aliases = ["roll", "die", "rng", "random"]; +exports.category = 4; +exports.help = "Rolls the dice"; \ No newline at end of file diff --git a/commands/dog.js b/commands/dog.js index a1d8ad3..aa09f36 100644 --- a/commands/dog.js +++ b/commands/dog.js @@ -15,3 +15,5 @@ exports.run = async (message) => { }; exports.aliases = ["doggos", "doggo", "pupper", "puppers", "dogs", "puppy", "puppies", "pups", "pup"]; +exports.category = 4; +exports.help = "Gets a random dog picture"; \ No newline at end of file diff --git a/commands/encode.js b/commands/encode.js index 2026645..7d05367 100644 --- a/commands/encode.js +++ b/commands/encode.js @@ -4,3 +4,5 @@ exports.run = async (message, args) => { }; exports.aliases = ["b64encode", "base64encode"]; +exports.category = 1; +exports.help = "Encodes a Base64 string"; \ No newline at end of file diff --git a/commands/eval.js b/commands/eval.js index 9d1751b..74458ef 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -13,3 +13,5 @@ exports.run = async (message, args) => { }; exports.aliases = ["run"]; +exports.category = 7; +exports.help = "Executes JavaScript code"; \ No newline at end of file diff --git a/commands/exec.js b/commands/exec.js index 2f16df8..441f01c 100644 --- a/commands/exec.js +++ b/commands/exec.js @@ -16,3 +16,5 @@ exports.run = async (message, args) => { }; exports.aliases = ["runcmd"]; +exports.category = 7; +exports.help = "Executes a terminal command"; \ No newline at end of file diff --git a/commands/explode.js b/commands/explode.js index 93ac5e7..ea65b32 100644 --- a/commands/explode.js +++ b/commands/explode.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to explode!`; - message.channel.sendTyping(); const data = gm(image.data).implode([-2]); const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { @@ -16,3 +16,5 @@ exports.run = async (message) => { }; exports.aliases = ["exp"]; +exports.category = 5; +exports.help = "Explodes an image"; \ No newline at end of file diff --git a/commands/explosion.js b/commands/explosion.js index df0789f..31b08d7 100644 --- a/commands/explosion.js +++ b/commands/explosion.js @@ -3,3 +3,6 @@ const playSound = require("../utils/soundplayer.js"); exports.run = async (message) => { return playSound("./assets/audio/explosion.opus", message); }; + +exports.category = 6; +exports.help = "Plays an explosion sound effect"; \ No newline at end of file diff --git a/commands/fakeping.js b/commands/fakeping.js index 433e6ea..69d95ab 100644 --- a/commands/fakeping.js +++ b/commands/fakeping.js @@ -5,3 +5,5 @@ exports.run = async (message) => { }; exports.aliases = ["notification", "notif"]; +exports.category = 6; +exports.help = "Plays a Discord ping sound effect"; \ No newline at end of file diff --git a/commands/fart.js b/commands/fart.js index a3f581c..238fed6 100644 --- a/commands/fart.js +++ b/commands/fart.js @@ -5,3 +5,5 @@ exports.run = async (message) => { }; exports.aliases = ["toot"]; +exports.category = 6; +exports.help = "Plays a fart sound effect"; \ No newline at end of file diff --git a/commands/fbi.js b/commands/fbi.js index 7195ead..4cdebe4 100644 --- a/commands/fbi.js +++ b/commands/fbi.js @@ -5,3 +5,5 @@ exports.run = async (message) => { }; exports.aliases = ["openup"]; +exports.category = 6; +exports.help = "Plays the \"FBI OPEN UP\" sound effect"; \ No newline at end of file diff --git a/commands/feedback.js b/commands/feedback.js index 91d2df6..843f1eb 100644 --- a/commands/feedback.js +++ b/commands/feedback.js @@ -33,3 +33,5 @@ exports.run = async (message, args) => { }; exports.aliases = ["request", "report", "complain", "compliment"]; +exports.category = 1; +exports.help = "Leaves some feedback for the bot owner"; \ No newline at end of file diff --git a/commands/flip.js b/commands/flip.js index e859258..b9e4c05 100644 --- a/commands/flip.js +++ b/commands/flip.js @@ -1,12 +1,15 @@ const sharp = require("sharp"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to flip!`; - message.channel.sendTyping(); const resultBuffer = await sharp(image.data).flip().toBuffer(); return message.channel.createMessage("", { file: resultBuffer, name: `flip.${image.type}` }); }; + +exports.category = 5; +exports.help = "Flips an image"; \ No newline at end of file diff --git a/commands/flop.js b/commands/flop.js index 46b8eea..d11c304 100644 --- a/commands/flop.js +++ b/commands/flop.js @@ -1,9 +1,9 @@ const sharp = require("sharp"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to flop!`; - message.channel.sendTyping(); const resultBuffer = await sharp(image.data).flop().toBuffer(); return message.channel.createMessage("", { file: resultBuffer, @@ -12,3 +12,5 @@ exports.run = async (message) => { }; exports.aliases = ["flip2"]; +exports.category = 5; +exports.help = "Flops an image"; \ No newline at end of file diff --git a/commands/fortnite.js b/commands/fortnite.js index 15fe096..7c867b2 100644 --- a/commands/fortnite.js +++ b/commands/fortnite.js @@ -5,3 +5,5 @@ exports.run = async (message) => { }; exports.aliases = ["dance", "defaultdance"]; +exports.category = 6; +exports.help = "Plays the Fortnite default dance sound"; \ No newline at end of file diff --git a/commands/fullwidth.js b/commands/fullwidth.js index 14c8c95..967aff9 100644 --- a/commands/fullwidth.js +++ b/commands/fullwidth.js @@ -4,3 +4,5 @@ exports.run = async (message, args) => { }; exports.aliases = ["aesthetic", "aesthetics", "aes"]; +exports.category = 4; +exports.help = "Converts a message to fullwidth/aesthetic text"; \ No newline at end of file diff --git a/commands/funky.js b/commands/funky.js index 927111f..5c1f30a 100644 --- a/commands/funky.js +++ b/commands/funky.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to add New Funky Mode!`; - message.channel.sendTyping(); const watermark = "./assets/images/funky.png"; gm(image.data).size(async (error, size) => { if (error) console.error; @@ -20,3 +20,5 @@ exports.run = async (message) => { }; exports.aliases = ["funkymode", "newfunkymode", "funkykong"]; +exports.category = 5; +exports.help = "Adds the New Funky Mode banner to an image"; \ No newline at end of file diff --git a/commands/gamexplain.js b/commands/gamexplain.js index 520ce7d..fc9d73f 100644 --- a/commands/gamexplain.js +++ b/commands/gamexplain.js @@ -5,9 +5,9 @@ const gmToBuffer = require("../utils/gmbuffer.js"); const fs = require("fs"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to make a GameXplain thumbnail meme!`; - message.channel.sendTyping(); const template = "./assets/images/gamexplain.png"; const path = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; require("util").promisify(fs.writeFile)(path, image.data); @@ -19,4 +19,6 @@ exports.run = async (message) => { }); }; -exports.aliases = ["gx"]; \ No newline at end of file +exports.aliases = ["gx"]; +exports.category = 5; +exports.help = "Makes a GameXplain thumbnail from an image"; \ No newline at end of file diff --git a/commands/haah.js b/commands/haah.js index 14e927e..7061219 100644 --- a/commands/haah.js +++ b/commands/haah.js @@ -5,9 +5,9 @@ const gm = require("gm").subClass({ }); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`; - message.channel.sendTyping(); const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; const data2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; gm(image.data).gravity("West").crop("50%", 0).strip().write(data2, (error) => { @@ -26,3 +26,5 @@ exports.run = async (message) => { }; exports.aliases = ["magik4", "mirror2"]; +exports.category = 5; +exports.help = "Mirrors the left side of an image onto the right"; \ No newline at end of file diff --git a/commands/hackban.js b/commands/hackban.js index a4aeae2..aa12f11 100644 --- a/commands/hackban.js +++ b/commands/hackban.js @@ -5,8 +5,10 @@ exports.run = async (message, args) => { return `Successfully banned user with ID \`${args[0]}\`.`; } catch (e) { console.error(e); - return `${message.author.mention}, I was unable to kick the member. Have you given me permissions?`; + return `${message.author.mention}, I was unable to ban the member. Have you given me permissions?`; } }; -exports.aliases = ["prevent", "preban"]; \ No newline at end of file +exports.aliases = ["prevent", "preban"]; +exports.category = 2; +exports.help = "Bans a member via user id"; \ No newline at end of file diff --git a/commands/help.js b/commands/help.js index 46a94b7..ca5d84d 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,6 +1,101 @@ const database = require("../utils/database.js"); +const collections = require("../utils/collections.js"); +const client = require("../utils/client.js"); +const misc = require("../utils/misc.js"); +const paginator = require("../utils/pagination/pagination.js"); +const tips = ["You can change the bot's prefix using the prefix command.", "Image commands also work with images previously posted in that channel.", "You can use the tags commands to save things for later use.", "You can visit https://essem.space/esmBot/commands.html?dev=true for a web version of this command list."]; -exports.run = async (message) => { +exports.run = async (message, args) => { const guild = (await database.guilds.find({ id: message.channel.guild.id }).exec())[0]; - return `${message.author.mention}, my command list can be found here: https://essem.space/esmBot/commands.html?dev=true\nThis server's prefix is \`${guild.prefix}\`.`; + const commands = Array.from(collections.commands.keys()); + if (args.length !== 0 && commands.includes(args[0].toLowerCase())) { + const info = collections.info.get(args[0].toLowerCase()); + const embed = { + "embed": { + "author": { + "name": "esmBot Dev Help", + "icon_url": client.user.avatarURL + }, + "title": args[0].toLowerCase(), + "description": info.description, + "color": 16711680, + "fields": [{ + "name": "Aliases", + "value": info.aliases ? info.aliases.join(", ") : "None" + }] + } + }; + return message.channel.createMessage(embed); + } else { + const categories = { + general: [], + moderation: [], + tags: [], + fun: [], + images: [], + soundboard: [], + admin: [] + }; + for (const command of commands) { + const category = collections.info.get(command).category; + const description = collections.info.get(command).description; + if (category === 1) { + categories.general.push(`**${command}** - ${description}`); + } else if (category === 2) { + categories.moderation.push(`**${command}** - ${description}`); + } else if (category === 3) { + categories.tags.push(`**${command}** - ${description}`); + } else if (category === 4) { + categories.fun.push(`**${command}** - ${description}`); + } else if (category === 5) { + categories.images.push(`**${command}** - ${description}`); + } else if (category === 6) { + categories.soundboard.push(`**${command}** - ${description}`); + } else if (category === 7) { + categories.admin.push(`**${command}** - ${description}`); + } + } + const pages = []; + for (const category of Object.keys(categories)) { + const splitPages = categories[category].map((item, index) => { + return index % 15 === 0 ? categories[category].slice(index, index + 15) : null; + }).filter((item) => { + return item; + }); + splitPages.forEach(page => { + pages.push({ + title: category.charAt(0).toUpperCase() + category.slice(1), + page: page + }); + }); + } + const embeds = []; + for (const [i, value] of pages.entries()) { + embeds.push({ + "embed": { + "author": { + "name": "esmBot Dev Help", + "icon_url": client.user.avatarURL + }, + "title": value.title, + "description": value.page.join("\n"), + "color": 16711680, + "footer": { + "text": `Page ${i + 1} of ${pages.length}` + }, + "fields": [{ + "name": "Prefix", + "value": guild.prefix + }, { + "name": "Tip", + "value": misc.random(tips) + }] + } + }); + } + return paginator(message, embeds); + } }; + +exports.category = 1; +exports.help = "Gets a list of commands"; \ No newline at end of file diff --git a/commands/hooh.js b/commands/hooh.js index 68b1aeb..269e173 100644 --- a/commands/hooh.js +++ b/commands/hooh.js @@ -5,9 +5,9 @@ const gm = require("gm").subClass({ }); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`; - message.channel.sendTyping(); const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; const data2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; gm(image.data).gravity("South").crop(0, "50%").strip().write(data2, (error) => { @@ -26,3 +26,5 @@ exports.run = async (message) => { }; exports.aliases = ["magik6", "mirror4"]; +exports.category = 5; +exports.help = "Mirrors the bottom of an image onto the top"; \ No newline at end of file diff --git a/commands/hypercam.js b/commands/hypercam.js index 1b863c7..ce199d5 100644 --- a/commands/hypercam.js +++ b/commands/hypercam.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Hypercam watermark!`; - message.channel.sendTyping(); const watermark = "./assets/images/hypercam.png"; gm(image.data).size(async (error, size) => { if (error) console.error; @@ -20,3 +20,5 @@ exports.run = async (message) => { }; exports.aliases = ["hcam"]; +exports.category = 5; +exports.help = "Adds the Hypercam watermark to an image"; \ No newline at end of file diff --git a/commands/ifunny.js b/commands/ifunny.js index 15e9d13..c389226 100644 --- a/commands/ifunny.js +++ b/commands/ifunny.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to add a iFunny watermark!`; - message.channel.sendTyping(); const watermark = "./assets/images/ifunny.png"; gm(image.data).size(async (error, size) => { if (error) console.error; @@ -18,3 +18,6 @@ exports.run = async (message) => { }); }); }; + +exports.category = 5; +exports.help = "Adds the iFunny watermark to an image"; \ No newline at end of file diff --git a/commands/image.js b/commands/image.js index 7370152..4975816 100644 --- a/commands/image.js +++ b/commands/image.js @@ -32,5 +32,6 @@ exports.run = async (message, args) => { }; exports.aliases = ["im", "photo", "img"]; - +exports.category = 1; +exports.help = "Searches for images on Google"; exports.requires = "google"; \ No newline at end of file diff --git a/commands/implode.js b/commands/implode.js index de3b828..f785357 100644 --- a/commands/implode.js +++ b/commands/implode.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to implode!`; - message.channel.sendTyping(); const data = gm(image.data).implode([1]); const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { @@ -16,3 +16,5 @@ exports.run = async (message) => { }; exports.aliases = ["imp"]; +exports.category = 5; +exports.help = "Implodes an image"; \ No newline at end of file diff --git a/commands/info.js b/commands/info.js index 516af83..0e2bb6e 100644 --- a/commands/info.js +++ b/commands/info.js @@ -1,8 +1,8 @@ const client = require("../utils/client.js"); +const dev = client.users.get(process.env.OWNER); +const artist = client.users.get("401980971517214723"); exports.run = async (message) => { - const dev = client.users.get(process.env.OWNER); - const artist = client.users.get("401980971517214723"); const infoEmbed = { "embed": { "description": "**You are currently using esmBot Dev! Things may change at any time without warning and there will be bugs. Many bugs.**", @@ -38,3 +38,5 @@ exports.run = async (message) => { }; exports.aliases = ["botinfo", "credits"]; +exports.category = 1; +exports.help = "Gets some info/credits about me"; \ No newline at end of file diff --git a/commands/invert.js b/commands/invert.js index 6df203c..015181e 100644 --- a/commands/invert.js +++ b/commands/invert.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to invert!`; - message.channel.sendTyping(); const data = gm(image.data).negative(); const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { @@ -16,3 +16,5 @@ exports.run = async (message) => { }; exports.aliases = ["inverse", "negate", "negative"]; +exports.category = 5; +exports.help = "Inverts an image's colors"; \ No newline at end of file diff --git a/commands/invite.js b/commands/invite.js index fe8e42f..ed78380 100644 --- a/commands/invite.js +++ b/commands/invite.js @@ -1,3 +1,6 @@ exports.run = async (message) => { return `${message.author.mention}, you can invite me to your server here: `; }; + +exports.category = 1; +exports.help = "Gets my bot invite link"; \ No newline at end of file diff --git a/commands/jpeg.js b/commands/jpeg.js index 68e2eeb..085f544 100644 --- a/commands/jpeg.js +++ b/commands/jpeg.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to add more JPEG!`; - message.channel.sendTyping(); const data = gm(image.data).setFormat("jpg").quality(1); const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { @@ -16,3 +16,5 @@ exports.run = async (message) => { }; exports.aliases = ["needsmorejpeg", "jpegify", "magik2", "morejpeg", "jpg"]; +exports.category = 5; +exports.help = "Adds max JPEG compression to an image"; \ No newline at end of file diff --git a/commands/kick.js b/commands/kick.js index 723c995..bc6fc04 100644 --- a/commands/kick.js +++ b/commands/kick.js @@ -16,3 +16,6 @@ exports.run = async (message) => { return `${message.author.mention}, you need to provide a member to kick!`; } }; + +exports.category = 2; +exports.help = "Kicks a member"; \ No newline at end of file diff --git a/commands/leak.js b/commands/leak.js index b078c9e..38961ee 100644 --- a/commands/leak.js +++ b/commands/leak.js @@ -5,9 +5,9 @@ const gmToBuffer = require("../utils/gmbuffer.js"); const fs = require("fs"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Super Smash Bros. leak meme!`; - message.channel.sendTyping(); const template = "./assets/images/leak.png"; const path = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; require("util").promisify(fs.writeFile)(path, image.data); @@ -19,4 +19,6 @@ exports.run = async (message) => { }); }; -exports.aliases = ["smash", "laxchris", "ssbu", "smashleak"]; \ No newline at end of file +exports.aliases = ["smash", "laxchris", "ssbu", "smashleak"]; +exports.category = 5; +exports.help = "Creates a fake Smash leak thumbnail from an image"; \ No newline at end of file diff --git a/commands/lengthen.js b/commands/lengthen.js index 9401a62..bf56da3 100644 --- a/commands/lengthen.js +++ b/commands/lengthen.js @@ -5,10 +5,11 @@ exports.run = async (message, args) => { message.channel.sendTyping(); if (args.length === 0 || !urlCheck(args[0])) return `${message.author.mention}, you need to provide a short URL to lengthen!`; if (urlCheck(args[0])) { - //const url = await require("url-unshort")().expand(args[0]); const url = await fetch(args[0], { redirect: "manual" }); return url.headers.get("location") || args[0]; } }; exports.aliases = ["longurl", "lengthenurl", "longuri", "lengthenuri", "unshorten"]; +exports.category = 1; +exports.help = "Lengthens a short URL"; \ No newline at end of file diff --git a/commands/magik.js b/commands/magik.js index 130819c..bee47a8 100644 --- a/commands/magik.js +++ b/commands/magik.js @@ -23,3 +23,5 @@ exports.run = async (message) => { }; exports.aliases = ["imagemagic", "imagemagick", "imagemagik", "magic", "magick", "cas", "liquid"]; +exports.category = 5; +exports.help = "Adds a content aware scale effect to an image"; \ No newline at end of file diff --git a/commands/mail.js b/commands/mail.js index 370152c..e0f3c6a 100644 --- a/commands/mail.js +++ b/commands/mail.js @@ -5,3 +5,5 @@ exports.run = async (message) => { }; exports.aliases = ["yougotmail", "youvegotmail", "aol"]; +exports.category = 6; +exports.help = "Plays the \"You've got mail\" sound effect"; \ No newline at end of file diff --git a/commands/mc.js b/commands/mc.js index 454c5c6..42d5035 100644 --- a/commands/mc.js +++ b/commands/mc.js @@ -12,3 +12,5 @@ exports.run = async (message, args) => { }; exports.aliases = ["ach", "achievement", "minecraft"]; +exports.category = 4; +exports.help = "Generates a Minecraft achievement image"; \ No newline at end of file diff --git a/commands/meme.js b/commands/meme.js index 81f4348..68df76a 100644 --- a/commands/meme.js +++ b/commands/meme.js @@ -1,10 +1,10 @@ const { spawn } = require("child_process"); exports.run = async (message, args) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to generate a meme!`; if (args.length === 0) return `${message.author.mention}, you need to provide some text to generate a meme!`; - message.channel.sendTyping(); const [topText, bottomText] = args.join(" ").split(",").map(elem => elem.trim()); const child = spawn("./utils/meme.sh", [topText.toUpperCase().replace(/\\/g, "\\\\"), bottomText ? bottomText.toUpperCase().replace(/\\/g, "\\\\") : ""]); child.stdin.write(image.data); @@ -26,4 +26,7 @@ exports.run = async (message, args) => { name: "meme.png" }); }); -}; \ No newline at end of file +}; + +exports.category = 5; +exports.help = "Generates a meme from an image"; \ No newline at end of file diff --git a/commands/memecenter.js b/commands/memecenter.js index 53d02e7..ff95a84 100644 --- a/commands/memecenter.js +++ b/commands/memecenter.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to add a MemeCenter watermark!`; - message.channel.sendTyping(); const watermark = "./assets/images/memecenter.png"; let resultBuffer; gm(image.data).size(async (error, size) => { @@ -28,4 +28,6 @@ exports.run = async (message) => { }); }; -exports.aliases = ["memec", "mcenter"]; \ No newline at end of file +exports.aliases = ["memec", "mcenter"]; +exports.category = 5; +exports.help = "Adds the MemeCenter watermark to an image"; \ No newline at end of file diff --git a/commands/oof.js b/commands/oof.js index 580d297..6315b6f 100644 --- a/commands/oof.js +++ b/commands/oof.js @@ -4,4 +4,6 @@ exports.run = async (message) => { return playSound("./assets/audio/oof.opus", message); }; -exports.aliases = ["roblox", "commitdie"]; \ No newline at end of file +exports.aliases = ["roblox", "commitdie"]; +exports.category = 6; +exports.help = "Plays the Roblox \"oof\" sound"; \ No newline at end of file diff --git a/commands/ping.js b/commands/ping.js index e32bb97..45537ca 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -6,3 +6,5 @@ exports.run = async (message) => { }; exports.aliases = ["pong"]; +exports.category = 1; +exports.help = "Pings the server I'm hosted on"; \ No newline at end of file diff --git a/commands/play.js b/commands/play.js index 1b55370..536c5c2 100644 --- a/commands/play.js +++ b/commands/play.js @@ -23,3 +23,6 @@ exports.run = async (message) => { return `${message.author.mention}, you need to be in a voice channel first!`; } }; + +exports.category = 7; +exports.help = "Plays an audio file"; \ No newline at end of file diff --git a/commands/prefix.js b/commands/prefix.js index 1afa4f1..3bba448 100644 --- a/commands/prefix.js +++ b/commands/prefix.js @@ -13,3 +13,5 @@ exports.run = async (message, args) => { }; exports.aliases = ["setprefix", "changeprefix", "checkprefix"]; +exports.category = 1; +exports.help = "Checks/changes the server prefix"; \ No newline at end of file diff --git a/commands/prunejuice.js b/commands/prunejuice.js index 03e9bd8..41d4937 100644 --- a/commands/prunejuice.js +++ b/commands/prunejuice.js @@ -4,4 +4,6 @@ exports.run = async (message) => { return playSound("./assets/audio/prunejuice.opus", message); }; -exports.aliases = ["juice", "grandma"]; \ No newline at end of file +exports.aliases = ["juice", "grandma"]; +exports.category = 6; +exports.help = "Plays the \"Drink yo prune juice\" sound effect"; \ No newline at end of file diff --git a/commands/purge.js b/commands/purge.js index eb4d882..19ae85d 100644 --- a/commands/purge.js +++ b/commands/purge.js @@ -12,4 +12,6 @@ exports.run = async (message, args) => { return; }; -exports.aliases = ["prune"]; \ No newline at end of file +exports.aliases = ["prune"]; +exports.category = 2; +exports.help = "Purges messages in a channel"; \ No newline at end of file diff --git a/commands/qrcreate.js b/commands/qrcreate.js index 5fc3143..bb27ed5 100644 --- a/commands/qrcreate.js +++ b/commands/qrcreate.js @@ -20,4 +20,7 @@ exports.run = async (message, args) => { name: "qr.png" }); }); -}; \ No newline at end of file +}; + +exports.category = 1; +exports.help = "Generates a QR code"; \ No newline at end of file diff --git a/commands/qrread.js b/commands/qrread.js index ca65e76..af0ac87 100644 --- a/commands/qrread.js +++ b/commands/qrread.js @@ -3,9 +3,12 @@ const sharp = require("sharp"); exports.run = async (message) => { const image = await require("../utils/imagedetect.js")(message); - if (image === undefined) return `${message.author.mention}, you need to provide an image with a QR code to read it!`; + if (image === undefined) return `${message.author.mention}, you need to provide an image with a QR code to read!`; message.channel.sendTyping(); const rawData = await sharp(image.data).ensureAlpha().raw().toBuffer({ resolveWithObject: true }); const qrBuffer = jsqr(rawData.data, rawData.info.width, rawData.info.height); return `\`\`\`\n${qrBuffer.data}\n\`\`\``; -}; \ No newline at end of file +}; + +exports.category = 1; +exports.help = "Reads a QR code"; \ No newline at end of file diff --git a/commands/reload.js b/commands/reload.js index af16070..4356dde 100644 --- a/commands/reload.js +++ b/commands/reload.js @@ -10,4 +10,7 @@ exports.run = async (message, args) => { } catch (error) { if (error) console.error; } -}; \ No newline at end of file +}; + +exports.category = 7; +exports.help = "Reloads a command"; \ No newline at end of file diff --git a/commands/restart.js b/commands/restart.js index f94a8e7..098e195 100644 --- a/commands/restart.js +++ b/commands/restart.js @@ -10,4 +10,6 @@ exports.run = async (message) => { process.exit(1); }; -exports.aliases = ["reboot"]; \ No newline at end of file +exports.aliases = ["reboot"]; +exports.category = 7; +exports.help = "Restarts me"; \ No newline at end of file diff --git a/commands/retro.js b/commands/retro.js index 7e0abd7..80cc063 100644 --- a/commands/retro.js +++ b/commands/retro.js @@ -2,9 +2,9 @@ const RetroText = require("retrotext"); exports.run = async (message, args) => { if (args.length === 0) return `${message.author.mention}, you need to provide some text to generate some retro text!`; + message.channel.sendTyping(); const [line1, line2, line3] = args.join(" ").split(",").map(elem => elem.trim()); if (/^[\w ]+$/i.test(line1) === false || /^[\w ]+$/i.test(line2) === false || /^[\w ]+$/i.test(line3) === false) return `${message.author.mention}, only alphanumeric characters, spaces, and underscores are allowed!`; - message.channel.sendTyping(); let text; if (line3) { text = new RetroText().setLine(1, line1).setLine(2, line2).setLine(3, line3).setBackgroundStyle("outlineTri").setTextStyle("chrome"); @@ -18,4 +18,7 @@ exports.run = async (message, args) => { file: textImage, name: "retro.png" }); -}; \ No newline at end of file +}; + +exports.category = 4; +exports.help = "Generates a retro text image"; \ No newline at end of file diff --git a/commands/rps.js b/commands/rps.js index 8915aa5..16a9747 100644 --- a/commands/rps.js +++ b/commands/rps.js @@ -22,4 +22,6 @@ exports.run = async (message, args) => { return args[0].toLowerCase() === result ? `${emoji} I chose ${result}. It's a tie!` : `${emoji} I chose ${result}. ${winOrLose ? "You win!" : "You lose!"}`; }; -exports.aliases = ["rockpaperscissors"]; \ No newline at end of file +exports.aliases = ["rockpaperscissors"]; +exports.category = 4; +exports.help = "Plays rock, paper, scissors with me"; \ No newline at end of file diff --git a/commands/scott.js b/commands/scott.js index 2668aa4..6af27d6 100644 --- a/commands/scott.js +++ b/commands/scott.js @@ -5,9 +5,9 @@ const gmToBuffer = require("../utils/gmbuffer.js"); const fs = require("fs"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Scott the Woz TV meme!`; - message.channel.sendTyping(); const template = "./assets/images/scott.png"; const path = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; require("util").promisify(fs.writeFile)(path, image.data); @@ -19,4 +19,6 @@ exports.run = async (message) => { }); }; -exports.aliases = ["woz", "tv", "porn"]; \ No newline at end of file +exports.aliases = ["woz", "tv", "porn"]; +exports.category = 5; +exports.help = "Creates a Scott the Woz TV image"; \ No newline at end of file diff --git a/commands/serverinfo.js b/commands/serverinfo.js index b840ff1..b067bbe 100644 --- a/commands/serverinfo.js +++ b/commands/serverinfo.js @@ -42,4 +42,6 @@ exports.run = async (message) => { return message.channel.createMessage(infoEmbed); }; -exports.aliases = ["server"]; \ No newline at end of file +exports.aliases = ["server"]; +exports.category = 1; +exports.help = "Gets some info about the server"; \ No newline at end of file diff --git a/commands/sharpen.js b/commands/sharpen.js index 9a65da7..4331616 100644 --- a/commands/sharpen.js +++ b/commands/sharpen.js @@ -1,9 +1,9 @@ const sharp = require("sharp"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to sharpen!`; - message.channel.sendTyping(); const resultBuffer = await sharp(image.data).sharpen(5).toBuffer(); return message.channel.createMessage("", { file: resultBuffer, @@ -12,4 +12,6 @@ exports.run = async (message) => { }; -exports.aliases = ["sharp"]; \ No newline at end of file +exports.aliases = ["sharp"]; +exports.category = 5; +exports.help = "Sharpens an image"; \ No newline at end of file diff --git a/commands/shorten.js b/commands/shorten.js index ea95e20..b47566d 100644 --- a/commands/shorten.js +++ b/commands/shorten.js @@ -8,4 +8,6 @@ exports.run = async (message, args) => { return url; }; -exports.aliases = ["urlshorten", "shortenlink", "urishorten", "shortenuri", "shortenurl"]; \ No newline at end of file +exports.aliases = ["urlshorten", "shortenlink", "urishorten", "shortenuri", "shortenurl"]; +exports.category = 1; +exports.help = "Shortens a URL"; diff --git a/commands/shutterstock.js b/commands/shutterstock.js index 33d145f..1650190 100644 --- a/commands/shutterstock.js +++ b/commands/shutterstock.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Shutterstock watermark!`; - message.channel.sendTyping(); const watermark = "./assets/images/shutterstock.png"; gm(image.data).size(async (error, size) => { if (error) console.error; @@ -19,4 +19,6 @@ exports.run = async (message) => { }); }; -exports.aliases = ["stock", "stockphoto"]; \ No newline at end of file +exports.aliases = ["stock", "stockphoto"]; +exports.category = 5; +exports.help = "Adds the Shutterstock watermark to an image"; \ No newline at end of file diff --git a/commands/snowflake.js b/commands/snowflake.js index ea5efcc..1b963f6 100644 --- a/commands/snowflake.js +++ b/commands/snowflake.js @@ -3,4 +3,6 @@ exports.run = async (message, args) => { return new Date((args[0] / 4194304) + 1420070400000).toUTCString(); }; -exports.aliases = ["timestamp", "snowstamp", "snow"]; \ No newline at end of file +exports.aliases = ["timestamp", "snowstamp", "snow"]; +exports.category = 1; +exports.help = "Converts a Discord snowflake into a timestamp"; \ No newline at end of file diff --git a/commands/sonic.js b/commands/sonic.js index 62019e0..9b6b012 100644 --- a/commands/sonic.js +++ b/commands/sonic.js @@ -5,7 +5,7 @@ const gmToBuffer = require("../utils/gmbuffer.js"); const wrap = require("../utils/wrap.js"); exports.run = async (message, args) => { - if (args.length === 0) return `${message.author.mention}, you need to provide an image to make a Sonic meme!`; + if (args.length === 0) return `${message.author.mention}, you need to provide some text to make a Sonic meme!`; message.channel.sendTyping(); const template = "./assets/images/sonic.jpg"; const file = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`; @@ -19,4 +19,7 @@ exports.run = async (message, args) => { name: "sonic.png" }); }); -}; \ No newline at end of file +}; + +exports.category = 4; +exports.help = "Creates a Sonic speech bubble image"; \ No newline at end of file diff --git a/commands/spam.js b/commands/spam.js index 9f5add1..02b89df 100644 --- a/commands/spam.js +++ b/commands/spam.js @@ -2,4 +2,7 @@ exports.run = async (message, args) => { if (args.length === 0) return `${message.author.mention}, you need to provide what you want to spam!`; if (message.content.includes("@everyone") || message.content.includes("@here")) return "I don't know about you, but that seems like a bad idea."; return args.join(" ").repeat(500).substring(0, 500); -}; \ No newline at end of file +}; + +exports.category = 8; +exports.help = "placeholder"; \ No newline at end of file diff --git a/commands/spin.js b/commands/spin.js index e2cd224..45cb16a 100644 --- a/commands/spin.js +++ b/commands/spin.js @@ -18,4 +18,6 @@ exports.run = async (message) => { }); }; -exports.aliases = ["rotate"]; \ No newline at end of file +exports.aliases = ["rotate"]; +exports.category = 5; +exports.help = "Spins an image"; \ No newline at end of file diff --git a/commands/stats.js b/commands/stats.js index 687edaa..837a832 100644 --- a/commands/stats.js +++ b/commands/stats.js @@ -39,4 +39,6 @@ exports.run = async (message) => { return message.channel.createMessage(embed); }; -exports.aliases = ["status", "stat"]; \ No newline at end of file +exports.aliases = ["status", "stat"]; +exports.category = 1; +exports.help = "Gets some statistics about me"; \ No newline at end of file diff --git a/commands/swirl.js b/commands/swirl.js index faaf43b..451a114 100644 --- a/commands/swirl.js +++ b/commands/swirl.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to swirl!`; - message.channel.sendTyping(); const data = gm(image.data).swirl(180); const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { @@ -16,3 +16,5 @@ exports.run = async (message) => { }; exports.aliases = ["whirlpool"]; +exports.category = 5; +exports.help = "Swirls an image"; \ No newline at end of file diff --git a/commands/tags.js b/commands/tags.js index 2c8c8bc..463cf46 100644 --- a/commands/tags.js +++ b/commands/tags.js @@ -81,4 +81,15 @@ const setTag = async (content, name, message, guild) => { return; }; -exports.aliases = ["t", "tag", "ta"]; \ No newline at end of file +exports.aliases = ["t", "tag", "ta"]; +exports.category = 3; +exports.help = "placeholder"; + +/*{ + default: "Gets a tag", + add: "Adds a tag", + delete: "Deletes a tag", + edit: "Edits a tag", + list: "Lists all tags in the server", + random: "Gets a random tag" +}*/ \ No newline at end of file diff --git a/commands/tile.js b/commands/tile.js index f89ac4e..958d881 100644 --- a/commands/tile.js +++ b/commands/tile.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to tile!`; - message.channel.sendTyping(); gm(image.data).command("montage").out("-duplicate").out(24).tile("5x5").geometry("+0+0").stream(async (error, output) => { if (error) console.error; const data = gm(output).resize("800x800>"); @@ -19,3 +19,5 @@ exports.run = async (message) => { }; exports.aliases = ["wall2"]; +exports.category = 5; +exports.help = "Creates a tile pattern from an image"; \ No newline at end of file diff --git a/commands/trump.js b/commands/trump.js index 9e3264e..3f25d63 100644 --- a/commands/trump.js +++ b/commands/trump.js @@ -5,9 +5,9 @@ const gmToBuffer = require("../utils/gmbuffer.js"); const fs = require("fs"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Trump meme!`; - message.channel.sendTyping(); const template = "./assets/images/trump.png"; const path = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; require("util").promisify(fs.writeFile)(path, image.data); @@ -17,4 +17,7 @@ exports.run = async (message) => { file: resultBuffer, name: "trump.png" }); -}; \ No newline at end of file +}; + +exports.category = 5; +exports.help = "Makes Trump display an image"; \ No newline at end of file diff --git a/commands/tweet.js b/commands/tweet.js index 74f3cf2..a12a6ba 100644 --- a/commands/tweet.js +++ b/commands/tweet.js @@ -8,4 +8,6 @@ exports.run = async (message, args) => { return `${message.author.mention}, a tweet with id ${info.data.id_str} has been posted with status code ${info.resp.statusCode} ${info.resp.statusMessage}.`; }; +exports.category = 7; +exports.help = "Tweets a message"; exports.requires = "twitter"; \ No newline at end of file diff --git a/commands/userinfo.js b/commands/userinfo.js index 300243d..16d10c0 100644 --- a/commands/userinfo.js +++ b/commands/userinfo.js @@ -46,4 +46,6 @@ exports.run = async (message, args) => { return message.channel.createMessage(infoEmbed); }; -exports.aliases = ["user"]; \ No newline at end of file +exports.aliases = ["user"]; +exports.category = 1; +exports.help = "Gets info about a user"; \ No newline at end of file diff --git a/commands/waaw.js b/commands/waaw.js index b726065..3546a5a 100644 --- a/commands/waaw.js +++ b/commands/waaw.js @@ -5,9 +5,9 @@ const gm = require("gm").subClass({ }); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`; - message.channel.sendTyping(); const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; const data2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; gm(image.data).gravity("East").crop("50%", 0).strip().write(data2, (error) => { @@ -26,4 +26,5 @@ exports.run = async (message) => { }; exports.aliases = ["magik3", "mirror"]; - +exports.category = 5; +exports.help = "Mirrors the right side of an image onto the left"; diff --git a/commands/wall.js b/commands/wall.js index df28361..4197632 100644 --- a/commands/wall.js +++ b/commands/wall.js @@ -4,9 +4,9 @@ const gm = require("gm").subClass({ const gmToBuffer = require("../utils/gmbuffer.js"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to make a wall from!`; - message.channel.sendTyping(); gm(image.data).resize(128).stream(async (error, output) => { if (error) console.error; const data = gm(output).virtualPixel("tile").matteColor("none").out("-background", "none").resize("512x512!").out("-distort").out("Perspective").out("0,0,57,42 0,128,63,130 128,0,140,60 128,128,140,140"); @@ -17,3 +17,6 @@ exports.run = async (message) => { }); }); }; + +exports.category = 5; +exports.help = "Creates a wall from an image"; \ No newline at end of file diff --git a/commands/wdt.js b/commands/wdt.js index 354b139..b863f7c 100644 --- a/commands/wdt.js +++ b/commands/wdt.js @@ -5,9 +5,9 @@ const gmToBuffer = require("../utils/gmbuffer.js"); const fs = require("fs"); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to make a "who did this" meme!`; - message.channel.sendTyping(); const template = "./assets/images/whodidthis.png"; const path = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; require("util").promisify(fs.writeFile)(path, image.data); @@ -19,4 +19,6 @@ exports.run = async (message) => { }); }; -exports.aliases = ["whodidthis"]; \ No newline at end of file +exports.aliases = ["whodidthis"]; +exports.category = 5; +exports.help = "Creates a \"WHO DID THIS\" meme from an image"; \ No newline at end of file diff --git a/commands/wikihow.js b/commands/wikihow.js index 91dd154..557b614 100644 --- a/commands/wikihow.js +++ b/commands/wikihow.js @@ -18,5 +18,6 @@ exports.run = async (message) => { }; exports.aliases = ["wiki"]; - +exports.category = 4; +exports.help = "Gets a random WikiHow image"; exports.requires = "mashape"; \ No newline at end of file diff --git a/commands/winxp.js b/commands/winxp.js index 2d10c29..f05be10 100644 --- a/commands/winxp.js +++ b/commands/winxp.js @@ -5,3 +5,5 @@ exports.run = async (message) => { }; exports.aliases = ["windows", "xp"]; +exports.category = 6; +exports.help = "Plays the Windows XP startup sound"; \ No newline at end of file diff --git a/commands/woow.js b/commands/woow.js index 55fe53e..994a8a5 100644 --- a/commands/woow.js +++ b/commands/woow.js @@ -5,9 +5,9 @@ const gm = require("gm").subClass({ }); exports.run = async (message) => { + message.channel.sendTyping(); const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`; - message.channel.sendTyping(); const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; const data2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; gm(image.data).gravity("North").crop(0, "50%").strip().write(data2, (error) => { @@ -26,3 +26,5 @@ exports.run = async (message) => { }; exports.aliases = ["magik5", "mirror3"]; +exports.category = 5; +exports.help = "Mirrors the top of an image onto the bottom"; \ No newline at end of file diff --git a/commands/xkcd.js b/commands/xkcd.js index c7f3ea3..c033716 100644 --- a/commands/xkcd.js +++ b/commands/xkcd.js @@ -17,7 +17,10 @@ exports.run = async (message, args) => { } }; return message.channel.createMessage(embed); - } catch { - return `${message.author.mention}, I couldn't find that XKCD!`; + } catch (e) { + return `${message.author.mention}, I couldn't get that XKCD!`; } -}; \ No newline at end of file +}; + +exports.category = 4; +exports.help = "Gets an XKCD comic"; \ No newline at end of file diff --git a/commands/yoda.js b/commands/yoda.js index 47c21cb..74f6898 100644 --- a/commands/yoda.js +++ b/commands/yoda.js @@ -7,4 +7,6 @@ exports.run = async (message, args) => { return json.yodish; }; -exports.aliases = ["yodish"]; \ No newline at end of file +exports.aliases = ["yodish"]; +exports.category = 4; +exports.help = "Translates a message to Yodish"; \ No newline at end of file diff --git a/commands/youtube.js b/commands/youtube.js index f13dee4..babf1d5 100644 --- a/commands/youtube.js +++ b/commands/youtube.js @@ -18,5 +18,6 @@ exports.run = async (message, args) => { }; exports.aliases = ["yt", "video", "ytsearch"]; - +exports.category = 1; +exports.help = "Searches YouTube"; exports.requires = "google"; \ No newline at end of file diff --git a/utils/collections.js b/utils/collections.js index edcd292..f823cfb 100644 --- a/utils/collections.js +++ b/utils/collections.js @@ -2,3 +2,4 @@ const { Collection } = require("eris"); exports.commands = new Collection(); exports.aliases = new Collection(); +exports.info = new Collection(); \ No newline at end of file diff --git a/utils/handler.js b/utils/handler.js index c5bcef9..a5bab7a 100644 --- a/utils/handler.js +++ b/utils/handler.js @@ -9,7 +9,11 @@ exports.load = async (command) => { if (props.requires === "mashape" && process.env.MASHAPE === "") return logger.log("info", `Mashape/RapidAPI info not provided in config, skipped loading command ${command}...`); if (props.requires === "twitter" && process.env.TWITTER === "false") return logger.log("info", `Twitter bot disabled, skipped loading command ${command}...`); collections.commands.set(command.split(".")[0], props.run); - // add each alias to + collections.info.set(command.split(".")[0], { + category: props.category, + description: props.help, + aliases: props.aliases + }); if (props.aliases) { props.aliases.forEach(alias => { collections.aliases.set(alias, command.split(".")[0]); diff --git a/utils/soundplayer.js b/utils/soundplayer.js index c888913..4e0673f 100644 --- a/utils/soundplayer.js +++ b/utils/soundplayer.js @@ -18,9 +18,6 @@ module.exports = async (sound, message) => { playingMessage.delete(); logger.error(error); }); - connection.on("warn", (warn) => { - logger.warn(warn); - }); connection.once("end", () => { voiceChannel.leave(); playingMessage.delete();