diff --git a/app.js b/app.js index aedce7bc..67ed2039 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 59da7b2a..69e72e59 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 feb4f7ac..ec2b025e 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 ddbe327b..3abaf1e9 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 6db09bee..6d600248 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 7e336158..d38c5788 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 6cc8a159..e2d92961 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 9f3ff60d..e39585e7 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 90e1ef99..a92fb674 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 4043d788..4188ed5f 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 06740ba3..fbd8c39b 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 e46c3a9b..bd033f9d 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 84cb3ab1..e165baac 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 cfc9d6cd..06a24c6b 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 acf941d7..623d69ef 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 de047893..60b5c018 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 b9734a9d..9d12b7ac 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 99f1c652..9fdf7846 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 12a81173..9a244190 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 6c885959..24ea32f8 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 fa945b59..42ad3168 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 a1d8ad38..aa09f36c 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 20266453..7d053677 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 9d1751b9..74458ef5 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 2f16df8f..441f01cb 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 93ac5e7c..ea65b321 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 df0789f0..31b08d7d 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 433e6ea6..69d95ab9 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 a3f581c7..238fed6d 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 7195eadd..4cdebe46 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 91d2df61..843f1ebd 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 e859258c..b9e4c055 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 46b8eeaa..d11c3040 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 15fe096c..7c867b27 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 14c8c95d..967aff9d 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 927111f1..5c1f30a1 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 520ce7da..fc9d73f7 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 14e927e3..70612191 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 a4aeae21..aa12f115 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 46a94b72..ca5d84d8 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 68b1aeb5..269e1738 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 1b863c71..ce199d50 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 15e9d135..c389226c 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 7370152b..49758164 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 de3b8286..f785357b 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 516af839..0e2bb6e9 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 6df203cc..015181e0 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 fe8e42f5..ed783807 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 68e2eebc..085f5440 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 723c9957..bc6fc043 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 b078c9e5..38961ee5 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 9401a627..bf56da34 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 130819c6..bee47a8f 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 370152cf..e0f3c6ab 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 454c5c64..42d5035e 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 81f43484..68df76ab 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 53d02e72..ff95a845 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 580d2977..6315b6f0 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 e32bb972..45537cab 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 1b553702..536c5c26 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 1afa4f1c..3bba4485 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 03e9bd89..41d4937e 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 eb4d882b..19ae85dc 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 5fc3143e..bb27ed53 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 ca65e76b..af0ac87e 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 af16070e..4356dde6 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 f94a8e71..098e1952 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 7e0abd7c..80cc0630 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 8915aa58..16a9747a 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 2668aa4e..6af27d6e 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 b840ff13..b067bbe1 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 9a65da70..43316162 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 ea95e207..b47566da 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 33d145f4..16501906 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 ea5efcc1..1b963f66 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 62019e03..9b6b0129 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 9f5add1a..02b89df6 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 e2cd224d..45cb16ae 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 687edaa3..837a832a 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 faaf43b0..451a1144 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 2c8c8bc5..463cf46c 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 f89ac4e7..958d8814 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 9e3264ed..3f25d637 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 74f3cf2d..a12a6bac 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 300243d0..16d10c03 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 b726065f..3546a5a0 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 df28361d..41976320 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 354b139b..b863f7c9 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 91dd1541..557b6148 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 2d10c295..f05be100 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 55fe53ea..994a8a5c 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 c7f3ea34..c0337161 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 47c21cb4..74f6898a 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 f13dee4c..babf1d54 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 edcd2920..f823cfb1 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 c5bcef9c..a5bab7ac 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 c888913b..4e0673f9 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();