Added new help command and command metadata, various changes

This commit is contained in:
TheEssem 2019-12-02 14:47:22 -06:00
parent c9f0ff3827
commit 3d225f6547
97 changed files with 456 additions and 155 deletions

2
app.js
View file

@ -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) {

View file

@ -1,6 +1,4 @@
const { random } = require("../utils/misc.js");
exports.run = async () => {
const responses = [
"It is certain",
"It is decidedly so",
@ -23,7 +21,11 @@ exports.run = async () => {
"Outlook not so good",
"Very doubtful"
];
exports.run = async () => {
return `🎱 ${random(responses)}`;
};
exports.aliases = ["magicball", "magikball", "magic8ball", "magik8ball", "eightball"];
exports.category = 4;
exports.help = "Asks the magic 8-ball a question";

View file

@ -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";

View file

@ -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";

View file

@ -11,3 +11,5 @@ exports.run = async (message, args) => {
};
exports.aliases = ["pfp", "ava"];
exports.category = 1;
exports.help = "Gets a user's avatar";

View file

@ -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";

View file

@ -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";

View file

@ -15,3 +15,5 @@ exports.run = async (message) => {
};
exports.aliases = ["birb", "birds", "birbs"];
exports.category = 4;
exports.help = "Gets a random bird picture";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -5,3 +5,5 @@ exports.run = async (message) => {
};
exports.aliases = ["boy", "neutron", "hugh"];
exports.category = 6;
exports.help = "Plays the \"boi\" sound effect";

View file

@ -5,3 +5,5 @@ exports.run = async (message) => {
};
exports.aliases = ["bro"];
exports.category = 6;
exports.help = "Plays the \"bruh\" sound effect";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -1,6 +1,4 @@
const cowsay = require("cowsay");
exports.run = async (message, args) => {
const cowList = ["beavis.zen",
"bong",
"bud-frogs",
@ -50,6 +48,8 @@ exports.run = async (message, args) => {
"whale",
"www"
];
exports.run = async (message, args) => {
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";

View file

@ -1,5 +1,7 @@
exports.run = async (message) => {
return `${message.author.mention}, my DBL page can be found here: <https://discordbots.org/bot/429305856241172480>`;
return `${message.author.mention}, my DBL page can be found here: <https://top.gg/bot/429305856241172480>`;
};
exports.aliases = ["discordbotlist", "botlist", "discordbots"];
exports.category = 1;
exports.help = "Gets my top.gg page";

View file

@ -4,3 +4,5 @@ exports.run = async (message, args) => {
};
exports.aliases = ["b64decode", "base64decode"];
exports.category = 1;
exports.help = "Decodes a Base64 string";

View file

@ -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";

View file

@ -13,3 +13,5 @@ exports.run = async (message, args) => {
};
exports.aliases = ["roll", "die", "rng", "random"];
exports.category = 4;
exports.help = "Rolls the dice";

View file

@ -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";

View file

@ -4,3 +4,5 @@ exports.run = async (message, args) => {
};
exports.aliases = ["b64encode", "base64encode"];
exports.category = 1;
exports.help = "Encodes a Base64 string";

View file

@ -13,3 +13,5 @@ exports.run = async (message, args) => {
};
exports.aliases = ["run"];
exports.category = 7;
exports.help = "Executes JavaScript code";

View file

@ -16,3 +16,5 @@ exports.run = async (message, args) => {
};
exports.aliases = ["runcmd"];
exports.category = 7;
exports.help = "Executes a terminal command";

View file

@ -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";

View file

@ -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";

View file

@ -5,3 +5,5 @@ exports.run = async (message) => {
};
exports.aliases = ["notification", "notif"];
exports.category = 6;
exports.help = "Plays a Discord ping sound effect";

View file

@ -5,3 +5,5 @@ exports.run = async (message) => {
};
exports.aliases = ["toot"];
exports.category = 6;
exports.help = "Plays a fart sound effect";

View file

@ -5,3 +5,5 @@ exports.run = async (message) => {
};
exports.aliases = ["openup"];
exports.category = 6;
exports.help = "Plays the \"FBI OPEN UP\" sound effect";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -5,3 +5,5 @@ exports.run = async (message) => {
};
exports.aliases = ["dance", "defaultdance"];
exports.category = 6;
exports.help = "Plays the Fortnite default dance sound";

View file

@ -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";

View file

@ -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";

View file

@ -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);
@ -20,3 +20,5 @@ exports.run = async (message) => {
};
exports.aliases = ["gx"];
exports.category = 5;
exports.help = "Makes a GameXplain thumbnail from an image";

View file

@ -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";

View file

@ -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"];
exports.category = 2;
exports.help = "Bans a member via user id";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -1,8 +1,8 @@
const client = require("../utils/client.js");
exports.run = async (message) => {
const dev = client.users.get(process.env.OWNER);
const artist = client.users.get("401980971517214723");
exports.run = async (message) => {
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";

View file

@ -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";

View file

@ -1,3 +1,6 @@
exports.run = async (message) => {
return `${message.author.mention}, you can invite me to your server here: <https://discordapp.com/oauth2/authorize?client_id=515571942418546689&scope=bot&permissions=70642766>`;
};
exports.category = 1;
exports.help = "Gets my bot invite link";

View file

@ -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";

View file

@ -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";

View file

@ -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);
@ -20,3 +20,5 @@ exports.run = async (message) => {
};
exports.aliases = ["smash", "laxchris", "ssbu", "smashleak"];
exports.category = 5;
exports.help = "Creates a fake Smash leak thumbnail from an image";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -12,3 +12,5 @@ exports.run = async (message, args) => {
};
exports.aliases = ["ach", "achievement", "minecraft"];
exports.category = 4;
exports.help = "Generates a Minecraft achievement image";

View file

@ -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);
@ -27,3 +27,6 @@ exports.run = async (message, args) => {
});
});
};
exports.category = 5;
exports.help = "Generates a meme from an image";

View file

@ -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) => {
@ -29,3 +29,5 @@ exports.run = async (message) => {
};
exports.aliases = ["memec", "mcenter"];
exports.category = 5;
exports.help = "Adds the MemeCenter watermark to an image";

View file

@ -5,3 +5,5 @@ exports.run = async (message) => {
};
exports.aliases = ["roblox", "commitdie"];
exports.category = 6;
exports.help = "Plays the Roblox \"oof\" sound";

View file

@ -6,3 +6,5 @@ exports.run = async (message) => {
};
exports.aliases = ["pong"];
exports.category = 1;
exports.help = "Pings the server I'm hosted on";

View file

@ -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";

View file

@ -13,3 +13,5 @@ exports.run = async (message, args) => {
};
exports.aliases = ["setprefix", "changeprefix", "checkprefix"];
exports.category = 1;
exports.help = "Checks/changes the server prefix";

View file

@ -5,3 +5,5 @@ exports.run = async (message) => {
};
exports.aliases = ["juice", "grandma"];
exports.category = 6;
exports.help = "Plays the \"Drink yo prune juice\" sound effect";

View file

@ -13,3 +13,5 @@ exports.run = async (message, args) => {
};
exports.aliases = ["prune"];
exports.category = 2;
exports.help = "Purges messages in a channel";

View file

@ -21,3 +21,6 @@ exports.run = async (message, args) => {
});
});
};
exports.category = 1;
exports.help = "Generates a QR code";

View file

@ -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\`\`\``;
};
exports.category = 1;
exports.help = "Reads a QR code";

View file

@ -11,3 +11,6 @@ exports.run = async (message, args) => {
if (error) console.error;
}
};
exports.category = 7;
exports.help = "Reloads a command";

View file

@ -11,3 +11,5 @@ exports.run = async (message) => {
};
exports.aliases = ["reboot"];
exports.category = 7;
exports.help = "Restarts me";

View file

@ -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");
@ -19,3 +19,6 @@ exports.run = async (message, args) => {
name: "retro.png"
});
};
exports.category = 4;
exports.help = "Generates a retro text image";

View file

@ -23,3 +23,5 @@ exports.run = async (message, args) => {
};
exports.aliases = ["rockpaperscissors"];
exports.category = 4;
exports.help = "Plays rock, paper, scissors with me";

View file

@ -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);
@ -20,3 +20,5 @@ exports.run = async (message) => {
};
exports.aliases = ["woz", "tv", "porn"];
exports.category = 5;
exports.help = "Creates a Scott the Woz TV image";

View file

@ -43,3 +43,5 @@ exports.run = async (message) => {
};
exports.aliases = ["server"];
exports.category = 1;
exports.help = "Gets some info about the server";

View file

@ -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,
@ -13,3 +13,5 @@ exports.run = async (message) => {
};
exports.aliases = ["sharp"];
exports.category = 5;
exports.help = "Sharpens an image";

View file

@ -9,3 +9,5 @@ exports.run = async (message, args) => {
};
exports.aliases = ["urlshorten", "shortenlink", "urishorten", "shortenuri", "shortenurl"];
exports.category = 1;
exports.help = "Shortens a URL";

View file

@ -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;
@ -20,3 +20,5 @@ exports.run = async (message) => {
};
exports.aliases = ["stock", "stockphoto"];
exports.category = 5;
exports.help = "Adds the Shutterstock watermark to an image";

View file

@ -4,3 +4,5 @@ exports.run = async (message, args) => {
};
exports.aliases = ["timestamp", "snowstamp", "snow"];
exports.category = 1;
exports.help = "Converts a Discord snowflake into a timestamp";

View file

@ -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`;
@ -20,3 +20,6 @@ exports.run = async (message, args) => {
});
});
};
exports.category = 4;
exports.help = "Creates a Sonic speech bubble image";

View file

@ -3,3 +3,6 @@ exports.run = async (message, args) => {
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);
};
exports.category = 8;
exports.help = "placeholder";

View file

@ -19,3 +19,5 @@ exports.run = async (message) => {
};
exports.aliases = ["rotate"];
exports.category = 5;
exports.help = "Spins an image";

View file

@ -40,3 +40,5 @@ exports.run = async (message) => {
};
exports.aliases = ["status", "stat"];
exports.category = 1;
exports.help = "Gets some statistics about me";

View file

@ -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";

View file

@ -82,3 +82,14 @@ const setTag = async (content, name, message, guild) => {
};
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"
}*/

View file

@ -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";

View file

@ -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);
@ -18,3 +18,6 @@ exports.run = async (message) => {
name: "trump.png"
});
};
exports.category = 5;
exports.help = "Makes Trump display an image";

View file

@ -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";

View file

@ -47,3 +47,5 @@ exports.run = async (message, args) => {
};
exports.aliases = ["user"];
exports.category = 1;
exports.help = "Gets info about a user";

View file

@ -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";

View file

@ -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";

View file

@ -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);
@ -20,3 +20,5 @@ exports.run = async (message) => {
};
exports.aliases = ["whodidthis"];
exports.category = 5;
exports.help = "Creates a \"WHO DID THIS\" meme from an image";

View file

@ -18,5 +18,6 @@ exports.run = async (message) => {
};
exports.aliases = ["wiki"];
exports.category = 4;
exports.help = "Gets a random WikiHow image";
exports.requires = "mashape";

View file

@ -5,3 +5,5 @@ exports.run = async (message) => {
};
exports.aliases = ["windows", "xp"];
exports.category = 6;
exports.help = "Plays the Windows XP startup sound";

View file

@ -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";

View file

@ -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!`;
}
};
exports.category = 4;
exports.help = "Gets an XKCD comic";

View file

@ -8,3 +8,5 @@ exports.run = async (message, args) => {
};
exports.aliases = ["yodish"];
exports.category = 4;
exports.help = "Translates a message to Yodish";

View file

@ -18,5 +18,6 @@ exports.run = async (message, args) => {
};
exports.aliases = ["yt", "video", "ytsearch"];
exports.category = 1;
exports.help = "Searches YouTube";
exports.requires = "google";

View file

@ -2,3 +2,4 @@ const { Collection } = require("eris");
exports.commands = new Collection();
exports.aliases = new Collection();
exports.info = new Collection();

View file

@ -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]);

View file

@ -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();