Added homebrew and emote, added command params to help and a help webpage generator, updated packages/readme
This commit is contained in:
parent
3d225f6547
commit
b6a2dd275a
44 changed files with 783 additions and 97 deletions
|
@ -28,4 +28,5 @@ exports.run = async () => {
|
|||
|
||||
exports.aliases = ["magicball", "magikball", "magic8ball", "magik8ball", "eightball"];
|
||||
exports.category = 4;
|
||||
exports.help = "Asks the magic 8-ball a question";
|
||||
exports.help = "Asks the magic 8-ball a question";
|
||||
exports.params = "{text}";
|
|
@ -13,4 +13,5 @@ exports.run = async (message, args) => {
|
|||
exports.aliases = ["add"];
|
||||
exports.category = 7;
|
||||
exports.help = "Adds a tweet to the database";
|
||||
exports.requires = "twitter";
|
||||
exports.requires = "twitter";
|
||||
exports.params = "[category] [message]";
|
|
@ -13,3 +13,4 @@ exports.run = async (message, args) => {
|
|||
exports.aliases = ["pfp", "ava"];
|
||||
exports.category = 1;
|
||||
exports.help = "Gets a user's avatar";
|
||||
exports.params = "{mention/id}";
|
|
@ -18,4 +18,5 @@ exports.run = async (message) => {
|
|||
};
|
||||
|
||||
exports.category = 2;
|
||||
exports.help = "Bans a server member";
|
||||
exports.help = "Bans a server member";
|
||||
exports.params = "[mention]";
|
|
@ -66,3 +66,4 @@ exports.run = async (message, args) => {
|
|||
exports.aliases = ["cow"];
|
||||
exports.category = 4;
|
||||
exports.help = "Makes an ASCII cow say a message";
|
||||
exports.params = "[text]";
|
|
@ -1,8 +1,10 @@
|
|||
exports.run = async (message, args) => {
|
||||
if (args.length === 0) return `${message.author.mention}, you need to provide a string to decode!`;
|
||||
const b64Decoded = Buffer.from(args.join(" "), "base64").toString("utf-8");
|
||||
return `\`\`\`\n${b64Decoded}\`\`\``;
|
||||
};
|
||||
|
||||
exports.aliases = ["b64decode", "base64decode"];
|
||||
exports.category = 1;
|
||||
exports.help = "Decodes a Base64 string";
|
||||
exports.help = "Decodes a Base64 string";
|
||||
exports.params = "[text]";
|
|
@ -14,4 +14,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.aliases = ["roll", "die", "rng", "random"];
|
||||
exports.category = 4;
|
||||
exports.help = "Rolls the dice";
|
||||
exports.help = "Rolls the dice";
|
||||
exports.params = "{number}";
|
20
commands/emote.js
Normal file
20
commands/emote.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
const emojiRegex = require("emoji-regex");
|
||||
|
||||
exports.run = async (message, args) => {
|
||||
if (args[0].match(/^<a?:.+:\d+>$/)) {
|
||||
return `https://cdn.discordapp.com/emojis/${args[0].replace(/^<(a)?:.+:(\d+)>$/, "$2")}.${args[0].replace(/^<(a)?:.+:(\d+)>$/, "$1") === "a" ? "gif" : "png"}`;
|
||||
} else if (args[0].match(emojiRegex)) {
|
||||
const codePoints = [];
|
||||
for (const codePoint of args[0]) {
|
||||
codePoints.push(codePoint.codePointAt(0).toString(16));
|
||||
}
|
||||
return `https://twemoji.maxcdn.com/v/latest/72x72/${codePoints.join("-")}.png`;
|
||||
} else {
|
||||
return `${message.author.mention}, you need to provide a valid emoji to get an image!`;
|
||||
}
|
||||
};
|
||||
|
||||
exports.aliases = ["e", "em", "hugemoji", "hugeemoji"];
|
||||
exports.category = 1;
|
||||
exports.help = "Gets a raw emote image";
|
||||
exports.params = "[emote]";
|
|
@ -1,8 +1,10 @@
|
|||
exports.run = async (message, args) => {
|
||||
if (args.length === 0) return `${message.author.mention}, you need to provide a string to encode!`;
|
||||
const b64Encoded = Buffer.from(args.join(" ")).toString("base64");
|
||||
return `\`\`\`\n${b64Encoded}\`\`\``;
|
||||
};
|
||||
|
||||
exports.aliases = ["b64encode", "base64encode"];
|
||||
exports.category = 1;
|
||||
exports.help = "Encodes a Base64 string";
|
||||
exports.help = "Encodes a Base64 string";
|
||||
exports.params = "[text]";
|
|
@ -14,4 +14,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.aliases = ["run"];
|
||||
exports.category = 7;
|
||||
exports.help = "Executes JavaScript code";
|
||||
exports.help = "Executes JavaScript code";
|
||||
exports.params = "[code]";
|
|
@ -17,4 +17,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.aliases = ["runcmd"];
|
||||
exports.category = 7;
|
||||
exports.help = "Executes a terminal command";
|
||||
exports.help = "Executes a terminal command";
|
||||
exports.params = "[command]";
|
|
@ -34,4 +34,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.aliases = ["request", "report", "complain", "compliment"];
|
||||
exports.category = 1;
|
||||
exports.help = "Leaves some feedback for the bot owner";
|
||||
exports.help = "Leaves some feedback for the bot owner";
|
||||
exports.params = "[message]";
|
|
@ -5,4 +5,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.aliases = ["aesthetic", "aesthetics", "aes"];
|
||||
exports.category = 4;
|
||||
exports.help = "Converts a message to fullwidth/aesthetic text";
|
||||
exports.help = "Converts a message to fullwidth/aesthetic text";
|
||||
exports.params = "[text]";
|
|
@ -11,4 +11,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.aliases = ["prevent", "preban"];
|
||||
exports.category = 2;
|
||||
exports.help = "Bans a member via user id";
|
||||
exports.help = "Bans a member via user id";
|
||||
exports.params = "[id]";
|
|
@ -3,25 +3,30 @@ 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."];
|
||||
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://projectlounge.pw/esmBot/help.html for a web version of this command list.", "You can view a command's aliases by putting the command name after the help command (e.g. help image).", "Parameters wrapped in [] are required, while parameters wrapped in {} are optional."];
|
||||
|
||||
exports.run = async (message, args) => {
|
||||
const guild = (await database.guilds.find({ id: message.channel.guild.id }).exec())[0];
|
||||
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 aliases = Array.from(collections.aliases.keys());
|
||||
if (args.length !== 0 && (commands.includes(args[0].toLowerCase()) || aliases.includes(args[0].toLowerCase()))) {
|
||||
const info = aliases.includes(args[0].toLowerCase()) ? collections.info.get(collections.aliases.get(args[0].toLowerCase())) : collections.info.get(args[0].toLowerCase());
|
||||
console.log(collections.aliases.get(args[0].toLowerCase()));
|
||||
const embed = {
|
||||
"embed": {
|
||||
"author": {
|
||||
"name": "esmBot Dev Help",
|
||||
"icon_url": client.user.avatarURL
|
||||
},
|
||||
"title": args[0].toLowerCase(),
|
||||
"title": `${guild.prefix}${aliases.includes(args[0].toLowerCase()) ? collections.aliases.get(args[0].toLowerCase()) : args[0].toLowerCase()}`,
|
||||
"description": info.description,
|
||||
"color": 16711680,
|
||||
"fields": [{
|
||||
"name": "Aliases",
|
||||
"value": info.aliases ? info.aliases.join(", ") : "None"
|
||||
}, {
|
||||
"name": "Parameters",
|
||||
"value": info.params ? info.params : "None"
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
@ -30,29 +35,30 @@ exports.run = async (message, args) => {
|
|||
const categories = {
|
||||
general: [],
|
||||
moderation: [],
|
||||
tags: [],
|
||||
tags: ["**Every command in this category is a subcommand of the tag command.**\n"],
|
||||
fun: [],
|
||||
images: [],
|
||||
images: ["**These commands support the PNG, JPEG, and WEBP formats.**\n"],
|
||||
soundboard: [],
|
||||
admin: []
|
||||
admin: ["**These commands are only available to the bot owner.**\n"]
|
||||
};
|
||||
for (const command of commands) {
|
||||
const category = collections.info.get(command).category;
|
||||
const description = collections.info.get(command).description;
|
||||
const params = collections.info.get(command).params;
|
||||
if (category === 1) {
|
||||
categories.general.push(`**${command}** - ${description}`);
|
||||
categories.general.push(`**${command}**${params ? ` ${params}` : ""} - ${description}`);
|
||||
} else if (category === 2) {
|
||||
categories.moderation.push(`**${command}** - ${description}`);
|
||||
categories.moderation.push(`**${command}**${params ? ` ${params}` : ""} - ${description}`);
|
||||
} else if (category === 3) {
|
||||
categories.tags.push(`**${command}** - ${description}`);
|
||||
categories.tags.push(`**${command}**${params ? ` ${params}` : ""} - ${description}`);
|
||||
} else if (category === 4) {
|
||||
categories.fun.push(`**${command}** - ${description}`);
|
||||
categories.fun.push(`**${command}**${params ? ` ${params}` : ""} - ${description}`);
|
||||
} else if (category === 5) {
|
||||
categories.images.push(`**${command}** - ${description}`);
|
||||
categories.images.push(`**${command}**${params ? ` ${params}` : ""} - ${description}`);
|
||||
} else if (category === 6) {
|
||||
categories.soundboard.push(`**${command}** - ${description}`);
|
||||
categories.soundboard.push(`**${command}**${params ? ` ${params}` : ""} - ${description}`);
|
||||
} else if (category === 7) {
|
||||
categories.admin.push(`**${command}** - ${description}`);
|
||||
categories.admin.push(`**${command}**${params ? ` ${params}` : ""} - ${description}`);
|
||||
}
|
||||
}
|
||||
const pages = [];
|
||||
|
@ -98,4 +104,5 @@ exports.run = async (message, args) => {
|
|||
};
|
||||
|
||||
exports.category = 1;
|
||||
exports.help = "Gets a list of commands";
|
||||
exports.help = "Gets a list of commands";
|
||||
exports.params = "{command}";
|
21
commands/homebrew.js
Normal file
21
commands/homebrew.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
const gm = require("gm").subClass({
|
||||
imageMagick: true
|
||||
});
|
||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||
|
||||
exports.run = async (message, args) => {
|
||||
if (args.length === 0) return `${message.author.mention}, you need to provide some text to make a Homebrew Channel edit!`;
|
||||
message.channel.sendTyping();
|
||||
const template = "./assets/images/hbc.png";
|
||||
const cleanedMessage = args.join(" ").toLowerCase().replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/\n/g, " ");
|
||||
const command = gm(template).gravity("Center").font("./assets/hbc.ttf").out("-kerning", "-5").fill("white").pointSize(96).drawText(0, 0, cleanedMessage);
|
||||
const resultBuffer = await gmToBuffer(command);
|
||||
return message.channel.createMessage("", {
|
||||
file: resultBuffer,
|
||||
name: "homebrew.png"
|
||||
});
|
||||
};
|
||||
|
||||
exports.aliases = ["hbc", "brew", "wiibrew"];
|
||||
exports.category = 4;
|
||||
exports.help = "Creates a Homebrew Channel edit";
|
|
@ -34,4 +34,5 @@ exports.run = async (message, args) => {
|
|||
exports.aliases = ["im", "photo", "img"];
|
||||
exports.category = 1;
|
||||
exports.help = "Searches for images on Google";
|
||||
exports.requires = "google";
|
||||
exports.requires = "google";
|
||||
exports.params = "[query]";
|
|
@ -18,4 +18,5 @@ exports.run = async (message) => {
|
|||
};
|
||||
|
||||
exports.category = 2;
|
||||
exports.help = "Kicks a member";
|
||||
exports.help = "Kicks a member";
|
||||
exports.params = "[mention]";
|
|
@ -12,4 +12,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.aliases = ["longurl", "lengthenurl", "longuri", "lengthenuri", "unshorten"];
|
||||
exports.category = 1;
|
||||
exports.help = "Lengthens a short URL";
|
||||
exports.help = "Lengthens a short URL";
|
||||
exports.params = "[url]";
|
|
@ -13,4 +13,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.aliases = ["ach", "achievement", "minecraft"];
|
||||
exports.category = 4;
|
||||
exports.help = "Generates a Minecraft achievement image";
|
||||
exports.help = "Generates a Minecraft achievement image";
|
||||
exports.params = "[text]";
|
|
@ -29,4 +29,5 @@ exports.run = async (message, args) => {
|
|||
};
|
||||
|
||||
exports.category = 5;
|
||||
exports.help = "Generates a meme from an image";
|
||||
exports.help = "Generates a meme from an image (separate top/bottom text with a comma)";
|
||||
exports.params = "[top text], {bottom text}";
|
|
@ -14,4 +14,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.aliases = ["setprefix", "changeprefix", "checkprefix"];
|
||||
exports.category = 1;
|
||||
exports.help = "Checks/changes the server prefix";
|
||||
exports.help = "Checks/changes the server prefix";
|
||||
exports.params = "{prefix}";
|
|
@ -14,4 +14,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.aliases = ["prune"];
|
||||
exports.category = 2;
|
||||
exports.help = "Purges messages in a channel";
|
||||
exports.help = "Purges messages in a channel";
|
||||
exports.params = "[number]";
|
|
@ -23,4 +23,5 @@ exports.run = async (message, args) => {
|
|||
};
|
||||
|
||||
exports.category = 1;
|
||||
exports.help = "Generates a QR code";
|
||||
exports.help = "Generates a QR code";
|
||||
exports.params = "[text]";
|
|
@ -13,4 +13,5 @@ exports.run = async (message, args) => {
|
|||
};
|
||||
|
||||
exports.category = 7;
|
||||
exports.help = "Reloads a command";
|
||||
exports.help = "Reloads a command";
|
||||
exports.params = "[command]";
|
|
@ -21,4 +21,5 @@ exports.run = async (message, args) => {
|
|||
};
|
||||
|
||||
exports.category = 4;
|
||||
exports.help = "Generates a retro text image";
|
||||
exports.help = "Generates a retro text image (separate lines with a comma)";
|
||||
exports.params = "[top text], {middle text}, {bottom text}";
|
|
@ -24,4 +24,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.aliases = ["rockpaperscissors"];
|
||||
exports.category = 4;
|
||||
exports.help = "Plays rock, paper, scissors with me";
|
||||
exports.help = "Plays rock, paper, scissors with me";
|
||||
exports.params = "[rock/paper/scissors]";
|
|
@ -11,3 +11,4 @@ exports.run = async (message, args) => {
|
|||
exports.aliases = ["urlshorten", "shortenlink", "urishorten", "shortenuri", "shortenurl"];
|
||||
exports.category = 1;
|
||||
exports.help = "Shortens a URL";
|
||||
exports.params = "[url]";
|
|
@ -5,4 +5,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.aliases = ["timestamp", "snowstamp", "snow"];
|
||||
exports.category = 1;
|
||||
exports.help = "Converts a Discord snowflake into a timestamp";
|
||||
exports.help = "Converts a Discord snowflake id into a timestamp";
|
||||
exports.params = "[id]";
|
|
@ -22,4 +22,5 @@ exports.run = async (message, args) => {
|
|||
};
|
||||
|
||||
exports.category = 4;
|
||||
exports.help = "Creates a Sonic speech bubble image";
|
||||
exports.help = "Creates a Sonic speech bubble image";
|
||||
exports.params = "[text]";
|
|
@ -5,4 +5,5 @@ exports.run = async (message, args) => {
|
|||
};
|
||||
|
||||
exports.category = 8;
|
||||
exports.help = "placeholder";
|
||||
exports.help = "placeholder";
|
||||
exports.params = "[text]";
|
|
@ -10,4 +10,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.category = 7;
|
||||
exports.help = "Tweets a message";
|
||||
exports.requires = "twitter";
|
||||
exports.requires = "twitter";
|
||||
exports.params = "[message]";
|
|
@ -48,4 +48,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.aliases = ["user"];
|
||||
exports.category = 1;
|
||||
exports.help = "Gets info about a user";
|
||||
exports.help = "Gets info about a user";
|
||||
exports.params = "{mention/id}";
|
|
@ -23,4 +23,5 @@ exports.run = async (message, args) => {
|
|||
};
|
||||
|
||||
exports.category = 4;
|
||||
exports.help = "Gets an XKCD comic";
|
||||
exports.help = "Gets an XKCD comic";
|
||||
exports.params = "{id}";
|
|
@ -9,4 +9,5 @@ exports.run = async (message, args) => {
|
|||
|
||||
exports.aliases = ["yodish"];
|
||||
exports.category = 4;
|
||||
exports.help = "Translates a message to Yodish";
|
||||
exports.help = "Translates a message to Yodish";
|
||||
exports.params = "[text]";
|
|
@ -20,4 +20,5 @@ exports.run = async (message, args) => {
|
|||
exports.aliases = ["yt", "video", "ytsearch"];
|
||||
exports.category = 1;
|
||||
exports.help = "Searches YouTube";
|
||||
exports.requires = "google";
|
||||
exports.requires = "google";
|
||||
exports.params = "[query]";
|
Loading…
Add table
Add a link
Reference in a new issue