Initial commit
61
.eslintrc.json
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": ["eslint:recommended", "plugin:promise/recommended"],
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "module",
|
||||||
|
"ecmaVersion": 2017
|
||||||
|
},
|
||||||
|
"plugins": ["promise"],
|
||||||
|
"rules": {
|
||||||
|
"no-console": "off",
|
||||||
|
"indent": [
|
||||||
|
"error",
|
||||||
|
2,
|
||||||
|
{
|
||||||
|
"SwitchCase": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"linebreak-style": [
|
||||||
|
"error",
|
||||||
|
"unix"
|
||||||
|
],
|
||||||
|
"quotes": [
|
||||||
|
"warn",
|
||||||
|
"double"
|
||||||
|
],
|
||||||
|
"semi": [
|
||||||
|
"warn",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
|
"keyword-spacing": [
|
||||||
|
"error", {
|
||||||
|
"before": true,
|
||||||
|
"after": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"space-before-blocks": [
|
||||||
|
"error", {
|
||||||
|
"functions": "always",
|
||||||
|
"keywords": "always",
|
||||||
|
"classes": "always"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"space-before-function-paren": [
|
||||||
|
"error", {
|
||||||
|
"anonymous": "never",
|
||||||
|
"named": "never",
|
||||||
|
"asyncArrow": "always"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"prefer-const": [
|
||||||
|
"error", {
|
||||||
|
"destructuring": "any",
|
||||||
|
"ignoreReadBeforeAssign": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"prefer-template": "error"
|
||||||
|
}
|
||||||
|
}
|
38
.gitignore
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
cache/
|
||||||
|
data/
|
||||||
|
appold.js
|
||||||
|
migrate.js
|
||||||
|
config.json
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
lib-cov
|
||||||
|
coverage
|
||||||
|
.nyc_output
|
||||||
|
.grunt
|
||||||
|
bower_components
|
||||||
|
.lock-wscript
|
||||||
|
build/Release
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
typings/
|
||||||
|
.npm
|
||||||
|
.eslintcache
|
||||||
|
.node_repl_history
|
||||||
|
*.tgz
|
||||||
|
.yarn-integrity
|
||||||
|
.env
|
||||||
|
.next
|
||||||
|
.ftpconfig
|
||||||
|
coverage.lcov
|
||||||
|
bannedusers.json
|
||||||
|
*.code-workspace
|
||||||
|
todo.txt
|
||||||
|
tweets.json
|
||||||
|
.vscode/
|
47
app.js
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
// check if using node 10 or higher
|
||||||
|
if (process.version.slice(1).split(".")[0] < 10) throw new Error("Node 10.0.0 or higher is required. Update Node on your system.");
|
||||||
|
|
||||||
|
// turn fs.readdir into a promise
|
||||||
|
const { promisify } = require("util");
|
||||||
|
const fs = require("fs");
|
||||||
|
const readdir = promisify(fs.readdir);
|
||||||
|
// fancy loggings
|
||||||
|
const logger = require("./utils/logger.js");
|
||||||
|
// start the client
|
||||||
|
const client = require("./utils/client.js");
|
||||||
|
// initialize command loader
|
||||||
|
const handler = require("./utils/handler.js");
|
||||||
|
|
||||||
|
// registers stuff and logs in the bot
|
||||||
|
async function init() {
|
||||||
|
// register commands
|
||||||
|
const commands = await readdir("./commands/");
|
||||||
|
logger.log("info", `Attempting to load ${commands.length} commands...`);
|
||||||
|
commands.forEach(commandFile => {
|
||||||
|
logger.log("info", `Loading command ${commandFile}...`);
|
||||||
|
try {
|
||||||
|
handler.load(commandFile);
|
||||||
|
} catch (e) {
|
||||||
|
logger.error(`Failed to register command ${commandFile.split(".")[0]}: ${e}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// register events
|
||||||
|
const events = await readdir("./events/");
|
||||||
|
logger.log("info", `Attempting to load ${events.length} events...`);
|
||||||
|
events.forEach(file => {
|
||||||
|
logger.log("info", `Loading event ${file}...`);
|
||||||
|
const eventName = file.split(".")[0];
|
||||||
|
const event = require(`./events/${file}`);
|
||||||
|
client.on(eventName, event);
|
||||||
|
});
|
||||||
|
|
||||||
|
// login
|
||||||
|
client.connect();
|
||||||
|
|
||||||
|
// post to DBL
|
||||||
|
// require("./utils/dbl.js");
|
||||||
|
}
|
||||||
|
|
||||||
|
// launch the bot
|
||||||
|
init();
|
BIN
assets/ImpactMix.ttf
Normal file
BIN
assets/audio/boat.opus
Normal file
BIN
assets/audio/boi.opus
Normal file
BIN
assets/audio/bruh.opus
Normal file
BIN
assets/audio/bus.opus
Normal file
BIN
assets/audio/explosion.opus
Normal file
BIN
assets/audio/fart.opus
Normal file
BIN
assets/audio/fbi.opus
Normal file
BIN
assets/audio/fortnite.opus
Normal file
BIN
assets/audio/gethelp.opus
Normal file
BIN
assets/audio/johnwick.opus
Normal file
BIN
assets/audio/macandcheese.opus
Normal file
BIN
assets/audio/mail.opus
Normal file
BIN
assets/audio/oof.opus
Normal file
BIN
assets/audio/ping.opus
Normal file
BIN
assets/audio/prunejuice.opus
Normal file
BIN
assets/audio/upermario.opus
Normal file
BIN
assets/audio/winxp.opus
Normal file
BIN
assets/images/9gag.png
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
assets/images/bandicam.png
Normal file
After Width: | Height: | Size: 68 KiB |
BIN
assets/images/brazzers.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
assets/images/deviantart.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
assets/images/funky.png
Normal file
After Width: | Height: | Size: 163 KiB |
BIN
assets/images/hypercam.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
assets/images/ifunny.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
assets/images/memecenter.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
assets/images/scott.png
Normal file
After Width: | Height: | Size: 279 KiB |
BIN
assets/images/shutterstock.png
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
assets/images/sonic.jpg
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
assets/images/whodidthis.png
Normal file
After Width: | Height: | Size: 68 KiB |
29
commands/8ball.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
const { random } = require("../utils/misc.js");
|
||||||
|
|
||||||
|
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"];
|
22
commands/9gag.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to add a 9GAG watermark!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const watermark = "./assets/images/9gag.png";
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const data = gm(imageBuffer).composite(watermark).gravity("East");
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `9gag.${image.type}`
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["ninegag", "gag"];
|
13
commands/avatar.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
const client = require("../utils/client.js");
|
||||||
|
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
if (message.mentions[0] !== undefined) {
|
||||||
|
return message.mentions[0].avatarURL;
|
||||||
|
} else if (client.users.get(args[0]) !== undefined) {
|
||||||
|
return client.users.get(args[0]).avatarURL;
|
||||||
|
} else {
|
||||||
|
return message.author.avatarURL;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["pfp", "ava"];
|
18
commands/ban.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
const client = require("../utils/client.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
if (!message.member.permission.has("banMembers")) return `${message.author.mention}, you need to have the \`Ban Members\` permission on this server to ban people!`;
|
||||||
|
if (!message.channel.guild.members.get(client.user.id).permission.has("banMembers") && !message.channel.permissionsOf(client.user.id).has("banMembers")) return `${message.author.mention}, I don't have the \`Ban Members\` permission!`;
|
||||||
|
const member = message.mentions[0];
|
||||||
|
if (member) {
|
||||||
|
try {
|
||||||
|
await message.channel.guild.banMember(member.id);
|
||||||
|
return `Successfully banned ${member.mention}.`;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
return `${message.author.mention}, I was unable to ban the member. Have you given me permissions?`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return `${message.author.mention}, you need to provide a member to ban!`;
|
||||||
|
}
|
||||||
|
};
|
25
commands/bandicam.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to add a Bandicam watermark!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const watermark = "./assets/images/bandicam.png";
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
gm(imageBuffer).size(async (error, size) => {
|
||||||
|
if (error) console.error;
|
||||||
|
const data = gm(imageBuffer).composite(watermark).gravity("North").resize(null, size.height);
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `bandicam.${image.type}`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["bandi"];
|
17
commands/bird.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch("http://shibe.online/api/birds");
|
||||||
|
const json = await imageData.json();
|
||||||
|
return message.channel.createMessage({
|
||||||
|
embed: {
|
||||||
|
color: 16711680,
|
||||||
|
image: {
|
||||||
|
url: json[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["birb", "birds", "birbs"];
|
15
commands/blur.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
const sharp = require("sharp");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to blur!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const resultBuffer = await sharp(imageBuffer).blur(5).toBuffer();
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `blur.${image.type}`
|
||||||
|
});
|
||||||
|
};
|
21
commands/blurple.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to make blurple!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const data = gm(imageBuffer).threshold(75, true).out("+level-colors").out("\"#7289DA\",white");
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `blurple.${image.type}`
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["blurp"];
|
7
commands/boat.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
const playSound = require("../utils/soundplayer.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
return playSound("./assets/audio/boat.opus", message);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["tape", "flextape", "phil", "philswift"];
|
7
commands/boi.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
const playSound = require("../utils/soundplayer.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
return playSound("./assets/audio/boi.opus", message);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["boy", "neutron", "hugh"];
|
25
commands/brazzers.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to add a Brazzers watermark!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const watermark = "./assets/images/brazzers.png";
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
gm(imageBuffer).size(async (error, size) => {
|
||||||
|
if (error) console.error;
|
||||||
|
const data = gm(imageBuffer).composite(watermark).gravity("SouthEast").resize(size.width, null);
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `brazzers.${image.type}`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["brazzer", "br"];
|
7
commands/bruh.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
const playSound = require("../utils/soundplayer.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
return playSound("./assets/audio/bruh.opus", message);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["bro"];
|
7
commands/bus.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
const playSound = require("../utils/soundplayer.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
return playSound("./assets/audio/bus.opus", message);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["noyelling", "busyell"];
|
22
commands/cat.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
const config = require("../config.json");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const data = await fetch("https://api.thecatapi.com/v1/images/search?format=json", {
|
||||||
|
headers: {
|
||||||
|
"x-api-key": config.catToken
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const json = await data.json();
|
||||||
|
return message.channel.createMessage({
|
||||||
|
embed: {
|
||||||
|
color: 16711680,
|
||||||
|
image: {
|
||||||
|
url: json[0].url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["kitters", "kitties", "kitty", "cattos", "catto", "cats"];
|
10
commands/catfact.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch("https://catfact.ninja/fact");
|
||||||
|
const json = await imageData.json();
|
||||||
|
return `🐱 **Did you know?** ${json.fact}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["kittyfact"];
|
21
commands/circle.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to add radial blur!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const data = gm(imageBuffer).out("-radial-blur", 10);
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `circle.${image.type}`
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["cblur", "radial", "radialblur"];
|
66
commands/cowsay.js
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
const cowsay = require("cowsay");
|
||||||
|
|
||||||
|
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.indexOf(args[0].toLowerCase()) > -1) {
|
||||||
|
const cow = args.shift().toLowerCase();
|
||||||
|
return `\`\`\`\n${cowsay.say({
|
||||||
|
text: args.join(" "),
|
||||||
|
f: cow
|
||||||
|
})}\n\`\`\``;
|
||||||
|
} else {
|
||||||
|
return `\`\`\`\n${cowsay.say({ text: args.join(" ") })}\n\`\`\``;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["cow"];
|
5
commands/dbl.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
exports.run = async (message) => {
|
||||||
|
return `${message.author.mention}, my DBL page can be found here: <https://discordbots.org/bot/429305856241172480>`;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["discordbotlist", "botlist", "discordbots"];
|
6
commands/decode.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
const b64Decoded = Buffer.from(args.join(" "), "base64").toString("utf-8");
|
||||||
|
return `\`\`\`\n${b64Decoded}\`\`\``;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["b64decode", "base64decode"];
|
25
commands/deviantart.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to add a DeviantArt watermark!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const watermark = "./assets/images/deviantart.png";
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
gm(imageBuffer).size(async (error, size) => {
|
||||||
|
if (error) console.error;
|
||||||
|
const data = gm(imageBuffer).composite(watermark).gravity("Center").resize(null, size.height);
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `deviantart.${image.type}`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["da", "deviant"];
|
15
commands/dice.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
const misc = require("../utils/misc.js");
|
||||||
|
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
if (args.length === 0) {
|
||||||
|
return `🎲 The dice landed on ${misc.random(Array.from(Array(6).keys())) + 1}.`;
|
||||||
|
} else {
|
||||||
|
if (args[0].match(/^\d+$/)) {
|
||||||
|
return `🎲 The dice landed on ${misc.random(Array.from(Array(parseInt(args[0])).keys())) + 1}.`;
|
||||||
|
} else {
|
||||||
|
return `🎲 The dice landed on ${misc.random(Array.from(Array(6).keys())) + 1}.`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["roll", "die", "rng", "random"];
|
17
commands/dog.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch("https://dog.ceo/api/breeds/image/random");
|
||||||
|
const json = await imageData.json();
|
||||||
|
return message.channel.createMessage({
|
||||||
|
embed: {
|
||||||
|
color: 16711680,
|
||||||
|
image: {
|
||||||
|
url: json.message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["doggos", "doggo", "pupper", "puppers", "dogs", "puppy", "puppies", "pups", "pup"];
|
10
commands/dogfact.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch("https://dog-api.kinduff.com/api/facts");
|
||||||
|
const json = await imageData.json();
|
||||||
|
return `🐶 **Did you know?** ${json.facts[0]}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["pupfact"];
|
6
commands/encode.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
const b64Encoded = Buffer.from(args.join(" ")).toString("base64");
|
||||||
|
return `\`\`\`\n${b64Encoded}\`\`\``;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["b64encode", "base64encode"];
|
15
commands/eval.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
const { clean } = require("../utils/misc.js");
|
||||||
|
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
if (message.author.id !== "198198681982205953") return `${message.author.mention}, only the bot owner can use eval!`;
|
||||||
|
const code = args.join(" ");
|
||||||
|
try {
|
||||||
|
const evaled = eval(code);
|
||||||
|
const cleaned = await clean(evaled);
|
||||||
|
return `\`\`\`js\n${cleaned}\n\`\`\``;
|
||||||
|
} catch (err) {
|
||||||
|
return `\`ERROR\` \`\`\`xl\n${await clean(err)}\n\`\`\``;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["run"];
|
21
commands/explode.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to explode!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const data = gm(imageBuffer).implode([-2]);
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `explode.${image.type}`
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["exp"];
|
5
commands/explosion.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
const playSound = require("../utils/soundplayer.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
return playSound("./assets/audio/explosion.opus", message);
|
||||||
|
};
|
7
commands/fakeping.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
const playSound = require("../utils/soundplayer.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
return playSound("./assets/audio/ping.opus", message);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["notification", "notif"];
|
7
commands/fart.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
const playSound = require("../utils/soundplayer.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
return playSound("./assets/audio/fart.opus", message);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["toot"];
|
7
commands/fbi.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
const playSound = require("../utils/soundplayer.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
return playSound("./assets/audio/fbi.opus", message);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["openup"];
|
35
commands/feedback.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
const client = require("../utils/client.js");
|
||||||
|
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
if (args.length !== 0) {
|
||||||
|
const feedbackChannel = client.guilds.get("592399417676529688").channels.get("592429860769497098");
|
||||||
|
feedbackChannel.createMessage({
|
||||||
|
embed: {
|
||||||
|
color: 16711680,
|
||||||
|
timestamp: new Date(),
|
||||||
|
thumbnail: {
|
||||||
|
url: message.author.avatarURL
|
||||||
|
},
|
||||||
|
author: {
|
||||||
|
name: "esmBot Feedback",
|
||||||
|
icon_url: client.user.avatarURL
|
||||||
|
},
|
||||||
|
fields: [{
|
||||||
|
name: "👥 Author:",
|
||||||
|
value: `${message.author.username}#${message.author.discriminator}`
|
||||||
|
}, {
|
||||||
|
name: "👪 Server:",
|
||||||
|
value: message.channel.guild.name
|
||||||
|
}, {
|
||||||
|
name: "💬 Message:",
|
||||||
|
value: args.join(" ")
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return `${message.author.mention}, your feedback has been sent!`;
|
||||||
|
} else {
|
||||||
|
return `${message.author.mention}, you need to provide some feedback to send!`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["request", "report", "complain", "compliment"];
|
15
commands/flip.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
const sharp = require("sharp");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to flip!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const resultBuffer = await sharp(imageBuffer).flip().toBuffer();
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `flip.${image.type}`
|
||||||
|
});
|
||||||
|
};
|
17
commands/flop.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
const sharp = require("sharp");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to flop!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const resultBuffer = await sharp(imageBuffer).flop().toBuffer();
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `flop.${image.type}`
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["flip2"];
|
7
commands/fortnite.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
const playSound = require("../utils/soundplayer.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
return playSound("./assets/audio/fortnite.opus", message);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["dance", "defaultdance"];
|
6
commands/fullwidth.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
if (args.length === 0) return `${message.author.mention}, you need to provide some text to convert to fullwidth!`;
|
||||||
|
return args.join("").replace(/[A-Za-z0-9]/g, (s) => { return String.fromCharCode(s.charCodeAt(0) + 0xFEE0); });
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["aesthetic", "aesthetics", "aes"];
|
25
commands/funky.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to add New Funky Mode!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const watermark = "./assets/images/funky.png";
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
gm(imageBuffer).size(async (error, size) => {
|
||||||
|
if (error) console.error;
|
||||||
|
const data = gm(imageBuffer).composite(watermark).gravity("NorthEast").resize(null, size.height);
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `funky.${image.type}`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["funkymode", "newfunkymode", "funkykong"];
|
32
commands/haah.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
// really don't like this file
|
||||||
|
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const tempy = require("tempy");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to mirror!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const data = tempy.file({ extension: image.type });
|
||||||
|
const data2 = tempy.file({ extension: image.type });
|
||||||
|
gm(imageBuffer).gravity("West").crop("50%", 0).strip().write(data2, (error) => {
|
||||||
|
if (error) console.error;
|
||||||
|
gm(data2).flop().strip().write(data, async (error) => {
|
||||||
|
if (error) console.error;
|
||||||
|
gm(data2).append(data, true).toBuffer(image.type, (error, resultBuffer) => {
|
||||||
|
if (error) console.error;
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `haah.${image.type}`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["magik4", "mirror2"];
|
6
commands/help.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
const database = require("../utils/database.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
const guildConf = database.settings.get(message.channel.guild.id);
|
||||||
|
return `${message.author.mention}, my command list can be found here: https://essem.space/esmBot/commands.html?dev=true\nThis server's prefix is \`${guildConf.prefix[0]}\`.`;
|
||||||
|
};
|
32
commands/hooh.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
// really don't like this file
|
||||||
|
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const tempy = require("tempy");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to mirror!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const data = tempy.file({ extension: image.type });
|
||||||
|
const data2 = tempy.file({ extension: image.type });
|
||||||
|
gm(imageBuffer).gravity("South").crop(0, "50%").strip().write(data2, (error) => {
|
||||||
|
if (error) console.error;
|
||||||
|
gm(data2).flip().strip().write(data, async (error) => {
|
||||||
|
if (error) console.error;
|
||||||
|
gm(data).append(data2).toBuffer(image.type, (error, resultBuffer) => {
|
||||||
|
if (error) console.error;
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `hooh.${image.type}`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["magik6", "mirror4"];
|
25
commands/hypercam.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to add a Hypercam watermark!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const watermark = "./assets/images/hypercam.png";
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
gm(imageBuffer).size(async (error, size) => {
|
||||||
|
if (error) console.error;
|
||||||
|
const data = gm(imageBuffer).composite(watermark).gravity("NorthWest").resize(null, size.height);
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `hypercam.${image.type}`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["hcam"];
|
23
commands/ifunny.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to add a iFunny watermark!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const watermark = "./assets/images/ifunny.png";
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
gm(imageBuffer).size(async (error, size) => {
|
||||||
|
if (error) console.error;
|
||||||
|
const data = gm(imageBuffer).append(watermark).gravity("South").resize(size.width, null);
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `ifunny.${image.type}`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
35
commands/image.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
const GoogleImages = require("google-images");
|
||||||
|
const client = require("../utils/client.js");
|
||||||
|
const paginator = require("../utils/pagination/pagination");
|
||||||
|
const config = require("../config.json");
|
||||||
|
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
if (!message.channel.guild.members.get(client.user.id).permission.has("addReactions") && !message.channel.permissionsOf(client.user.id).has("addReactions")) return `${message.author.mention}, I don't have the \`Add Reactions\` permission!`;
|
||||||
|
if (!message.channel.guild.members.get(client.user.id).permission.has("embedLinks") && !message.channel.permissionsOf(client.user.id).has("embedLinks")) return `${message.author.mention}, I don't have the \`Embed Links\` permission!`;
|
||||||
|
if (args.length === 0) return `${message.author.mention}, you need to provide something to search for!`;
|
||||||
|
const embeds = [];
|
||||||
|
const imageSearch = new GoogleImages(config.cseID, config.googleKey);
|
||||||
|
const images = await imageSearch.search(args.join(" "), { safe: "high" });
|
||||||
|
for (const [i, value] of images.entries()) {
|
||||||
|
embeds.push({
|
||||||
|
"embed": {
|
||||||
|
"title": "Search Results",
|
||||||
|
"color": 16711680,
|
||||||
|
"footer": {
|
||||||
|
"text": `Page ${i + 1} of ${images.length}`
|
||||||
|
},
|
||||||
|
"image": {
|
||||||
|
"url": value.url
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"name": message.author.username,
|
||||||
|
"icon_url": message.author.avatarURL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (embeds.length === 0) return `${message.author.mention}, I couldn't find any results!`;
|
||||||
|
return paginator(message, embeds);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["im", "photo", "img"];
|
21
commands/implode.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to implode!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const data = gm(imageBuffer).implode([1]);
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `implode.${image.type}`
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["imp"];
|
41
commands/info.js
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
const client = require("../utils/client.js");
|
||||||
|
const config = require("../config.json");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
const dev = client.users.get(config.botOwner);
|
||||||
|
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.**",
|
||||||
|
"color": 16711680,
|
||||||
|
"author": {
|
||||||
|
"name": "esmBot Info/Credits",
|
||||||
|
"icon_url": client.user.avatarURL
|
||||||
|
},
|
||||||
|
"fields": [{
|
||||||
|
"name": "📝 Credits:",
|
||||||
|
"value": `Bot by **${dev.username}#${dev.discriminator}**\nIcon by **${artist.username}#${artist.discriminator}**`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "👪 Total Users:",
|
||||||
|
"value": client.users.size
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "💬 Total Servers:",
|
||||||
|
"value": client.guilds.size
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "✅ Official Server:",
|
||||||
|
"value": "[Click here!](https://discord.gg/vfFM7YT)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "💻 Source Code:",
|
||||||
|
"value": "[Click here!](https://github.com/TheEssem/esmBot-rewrite)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return message.channel.createMessage(infoEmbed);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["botinfo", "credits"];
|
21
commands/invert.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to invert!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const data = gm(imageBuffer).negative();
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `invert.${image.type}`
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["inverse", "negate", "negative"];
|
3
commands/invite.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
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>`;
|
||||||
|
};
|
21
commands/jpeg.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to add more JPEG!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const data = gm(imageBuffer).setFormat("jpg").quality(1);
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: "jpeg.jpg"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["needsmorejpeg", "jpegify", "magik2", "morejpeg", "jpg"];
|
18
commands/kick.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
const client = require("../utils/client.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
if (!message.member.permission.has("kickMembers")) return `${message.author.mention}, you need to have the \`Kick Members\` permission on this server to kick people!`;
|
||||||
|
if (!message.channel.guild.members.get(client.user.id).permission.has("kickMembers") && !message.channel.permissionsOf(client.user.id).has("kickMembers")) return `${message.author.mention}, I don't have the \`Kick Members\` permission!`;
|
||||||
|
const member = message.mentions[0];
|
||||||
|
if (member) {
|
||||||
|
try {
|
||||||
|
await message.channel.guild.kickMember(member.id);
|
||||||
|
return `Successfully kicked ${member.mention}.`;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
return `${message.author.mention}, I was unable to kick the member. Have you given me permissions?`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return `${message.author.mention}, you need to provide a member to kick!`;
|
||||||
|
}
|
||||||
|
};
|
12
commands/lengthen.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
const urlCheck = require("../utils/urlcheck.js");
|
||||||
|
|
||||||
|
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]);
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["longurl", "lengthenurl", "longuri", "lengthenuri", "unshorten"];
|
28
commands/magik.js
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to add some magik!`;
|
||||||
|
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
gm(imageBuffer).resize(800, 800).stream((error, stream) => {
|
||||||
|
if (error) console.error;
|
||||||
|
gm(stream).out("-liquid-rescale", "400x400").stream(async (error, stream2) => {
|
||||||
|
if (error) console.error;
|
||||||
|
const data = gm(stream2).out("-liquid-rescale", "1200x1200");
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
await processMessage.delete();
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `magik.${image.type}`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["imagemagic", "imagemagick", "imagemagik", "magic", "magick", "cas", "liquid"];
|
7
commands/mail.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
const playSound = require("../utils/soundplayer.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
return playSound("./assets/audio/mail.opus", message);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["yougotmail", "youvegotmail", "aol"];
|
14
commands/mc.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
if (args.length === 0) return `${message.author.mention}, you need to provide some text to generate a Minecraft achievement!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const request = await fetch(`https://www.minecraftskinstealer.com/achievement/a.php?i=13&h=Achievement+get%21&t=${args.join("+")}`);
|
||||||
|
const buffer = await request.buffer();
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: buffer,
|
||||||
|
name: "mc.png"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["ach", "achievement", "minecraft"];
|
32
commands/meme.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
const { spawn } = require("child_process");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
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 request = await fetch(image.url);
|
||||||
|
const buffer = await request.buffer();
|
||||||
|
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(buffer);
|
||||||
|
child.stdin.end();
|
||||||
|
const chunks = [];
|
||||||
|
child.stdout.on("data", (data) => {
|
||||||
|
chunks.push(data);
|
||||||
|
});
|
||||||
|
child.once("error", (error) => {
|
||||||
|
if (error) console.error;
|
||||||
|
});
|
||||||
|
child.stderr.once("data", (error) => {
|
||||||
|
if (error) console.error;
|
||||||
|
});
|
||||||
|
child.stdout.once("close", () => {
|
||||||
|
const data = Buffer.concat(chunks);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: data,
|
||||||
|
name: "meme.png"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
34
commands/memecenter.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
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 to add a MemeCenter watermark!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const watermark = "./assets/images/memecenter.png";
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
let resultBuffer;
|
||||||
|
gm(imageBuffer).size(async (error, size) => {
|
||||||
|
if (error) console.error;
|
||||||
|
const command = gm(imageBuffer).out(watermark).background("#FFFFFF").gravity("East").out("-smush").out("-9");
|
||||||
|
const output = await gmToBuffer(command);
|
||||||
|
gm(output).size(async (error, size2) => {
|
||||||
|
if (error) console.error;
|
||||||
|
resultBuffer = output;
|
||||||
|
if (size.width !== size2.width) {
|
||||||
|
const command2 = gm(output).gravity("West").chop(size2.width - size.width, 0);
|
||||||
|
resultBuffer = await gmToBuffer(command2);
|
||||||
|
}
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: "memecenter.png"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["memec", "mcenter"];
|
7
commands/oof.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
const playSound = require("../utils/soundplayer.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
return playSound("./assets/audio/oof.opus", message);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["roblox", "commitdie"];
|
8
commands/ping.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
const client = require("../utils/client.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
const pingMessage = await client.createMessage(message.channel.id, "🏓 Ping?");
|
||||||
|
return pingMessage.edit(`🏓 Pong! Latency is ${pingMessage.timestamp - message.timestamp}ms. API Latency is ${Math.round(client.shards.get(client.guildShardMap[message.channel.guild.id]).latency)}ms.`);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["pong"];
|
25
commands/play.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
const client = require("../utils/client.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
if (message.member.voiceState.channelID) {
|
||||||
|
if (!message.channel.guild.members.get(client.user.id).permission.has("voiceConnect") || !message.channel.permissionsOf(client.user.id).has("voiceConnect")) return `${message.author.mention}, I can't join this voice channel!`;
|
||||||
|
if (message.author.id !== "198198681982205953") return "this command is for testing and is restricted to owners lol";
|
||||||
|
const voiceChannel = message.channel.guild.channels.get(message.member.voiceState.channelID);
|
||||||
|
client.createMessage(message.channel.id, "🔊 Playing music...");
|
||||||
|
const connection = await voiceChannel.join();
|
||||||
|
connection.play(message.attachments[0].url, {
|
||||||
|
inlineVolume: true
|
||||||
|
});
|
||||||
|
connection.setVolume(0.5);
|
||||||
|
connection.on("error", () => {
|
||||||
|
voiceChannel.leave();
|
||||||
|
console.error;
|
||||||
|
});
|
||||||
|
connection.on("end", () => {
|
||||||
|
voiceChannel.leave();
|
||||||
|
return "This music session has now ended.";
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return `${message.author.mention}, you need to be in a voice channel first!`;
|
||||||
|
}
|
||||||
|
};
|
13
commands/prefix.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
const database = require("../utils/database.js");
|
||||||
|
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
if (args.length !== 0) {
|
||||||
|
if (!message.member.permission.has("administrator") && message.member.id !== "198198681982205953") return `${message.author.mention}, you need to be an administrator to change the bot prefix!`;
|
||||||
|
database.settings.set(message.channel.guild.id, args[0], "prefix");
|
||||||
|
return `The prefix has been changed to ${args[0]}.`;
|
||||||
|
} else {
|
||||||
|
return `${message.author.mention}, the current prefix is \`${database.settings.get(message.channel.guild.id, "prefix")}\`.`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["setprefix", "changeprefix", "checkprefix"];
|
7
commands/prunejuice.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
const playSound = require("../utils/soundplayer.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
return playSound("./assets/audio/prunejuice.opus", message);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["juice", "grandma"];
|
20
commands/purge.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
const client = require("../utils/client.js");
|
||||||
|
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
if (!message.member.permission.has("manageMessages")) return `${message.author.mention}, you need to have the \`Manage Messages\` permission on this server to ban people!`;
|
||||||
|
if (!message.channel.guild.members.get(client.user.id).permission.has("manageMessages") && !message.channel.permissionsOf(client.user.id).has("manageMessages")) return `${message.author.mention}, I don't have the \`Manage Messages\` permission!`;
|
||||||
|
if (args.length === 0 || !args[0].match(/^\d+$/)) return `${message.author.mention}, you need to provide the number of messages to purge!`;
|
||||||
|
const numberOfMessages = parseInt(args[0]) + 1;
|
||||||
|
const messageCollection = await message.channel.getMessages(numberOfMessages);
|
||||||
|
const messages = [];
|
||||||
|
for (const messageObject of messageCollection) {
|
||||||
|
messages.push(messageObject.id);
|
||||||
|
}
|
||||||
|
await message.channel.deleteMessages(messages);
|
||||||
|
const purgeMessage = await message.channel.createMessage(`Successfully purged ${args[0]} messages.`);
|
||||||
|
await require("util").promisify(setTimeout)(10000);
|
||||||
|
await purgeMessage.delete();
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["prune"];
|
23
commands/qrcreate.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
const qrcode = require("qrcode");
|
||||||
|
const stream = require("stream");
|
||||||
|
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
if (args.length === 0) return `${message.author.mention}, you need to provide some text to generate a QR code!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const writable = new stream.PassThrough();
|
||||||
|
qrcode.toFileStream(writable, args.join(" "), { margin: 1 });
|
||||||
|
const chunks = [];
|
||||||
|
writable.on("data", (chunk) => {
|
||||||
|
chunks.push(chunk);
|
||||||
|
});
|
||||||
|
writable.once("error", (error) => {
|
||||||
|
if (error) console.error;
|
||||||
|
});
|
||||||
|
writable.once("end", () => {
|
||||||
|
const imageBuffer = Buffer.concat(chunks);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: imageBuffer,
|
||||||
|
name: "qr.png"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
14
commands/qrread.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
const jsqr = require("jsqr");
|
||||||
|
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!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const rawData = await sharp(imageBuffer).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
||||||
|
const qrBuffer = jsqr(rawData.data, rawData.info.width, rawData.info.height);
|
||||||
|
return `\`\`\`\n${qrBuffer.data}\n\`\`\``;
|
||||||
|
};
|
13
commands/reload.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
const handler = require("../utils/handler.js");
|
||||||
|
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
if (message.author.id !== require("../config.json").botOwner) return `${message.author.mention}, only the bot owner can reload commands!`;
|
||||||
|
if (args.length === 0) return `${message.author.mention}, you need to provide a command to reload!`;
|
||||||
|
try {
|
||||||
|
await handler.unload(args[0]);
|
||||||
|
await handler.load(args[0]);
|
||||||
|
return `${message.author.mention}, the command \`${args[0]}\` has been reloaded.`;
|
||||||
|
} catch (error) {
|
||||||
|
if (error) console.error;
|
||||||
|
}
|
||||||
|
};
|
13
commands/restart.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
const handler = require("../utils/handler.js");
|
||||||
|
const collections = require("../utils/collections.js");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
if (message.author.id !== require("../config.json").botOwner) return `${message.author.mention}, only the bot owner can restart me!`;
|
||||||
|
await message.channel.createMessage(`${message.author.mention}, esmBot is restarting.`);
|
||||||
|
collections.commands.forEach(async (command) => {
|
||||||
|
await handler.unload(command);
|
||||||
|
});
|
||||||
|
process.exit(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["reboot"];
|
21
commands/retro.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
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!`;
|
||||||
|
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");
|
||||||
|
} else if (line2) {
|
||||||
|
text = new RetroText().setLine(1, line1).setLine(2, line2).setBackgroundStyle("outlineTri").setTextStyle("chrome");
|
||||||
|
} else {
|
||||||
|
text = new RetroText().setLine(2, line1).setBackgroundStyle("outlineTri").setTextStyle("chrome");
|
||||||
|
}
|
||||||
|
const textImage = await text.fetchBuffer();
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: textImage,
|
||||||
|
name: "retro.png"
|
||||||
|
});
|
||||||
|
};
|
25
commands/rps.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
if (args.length === 0 || (args[0] !== "rock" && args[0] !== "paper" && args[0] !== "scissors")) return `${message.author.mention}, you need to choose whether you want to be rock, paper, or scissors!`;
|
||||||
|
let emoji;
|
||||||
|
let winOrLose;
|
||||||
|
const result = require("../utils/misc.js").random(["rock", "paper", "scissors"]);
|
||||||
|
switch (result) {
|
||||||
|
case "rock":
|
||||||
|
emoji = "✊";
|
||||||
|
if (args[0].toLowerCase() === "paper") winOrLose = 1;
|
||||||
|
break;
|
||||||
|
case "paper":
|
||||||
|
emoji = "✋";
|
||||||
|
if (args[0].toLowerCase() === "scissors") winOrLose = 1;
|
||||||
|
break;
|
||||||
|
case "scissors":
|
||||||
|
emoji = "✌";
|
||||||
|
if (args[0].toLowerCase() === "rock") winOrLose = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
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"];
|
25
commands/scott.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
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 to make a Scott the Woz TV meme!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const template = "./assets/images/scott.png";
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const path = require("tempy").file({ extension: image.type });
|
||||||
|
require("util").promisify(fs.writeFile)(path, imageBuffer);
|
||||||
|
const command = gm(template).out("-gravity").out("Center").out("(").out(path).out("-virtual-pixel").out("transparent").out("-resize").out("415x234!").out("+distort").out("Perspective").out("0,0 129,187 415,0 517,182 415,234 517,465 0,234 132,418").out("-geometry").out("-110+83").out(")").out("-composite");
|
||||||
|
const resultBuffer = await gmToBuffer(command);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: "scott.png"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["woz", "tv", "porn"];
|