More uniform group names

This commit is contained in:
Dragon Fire
2020-04-09 14:37:24 -04:00
parent 35970740e3
commit 2bf570f3d2
139 changed files with 154 additions and 154 deletions
+53
View File
@@ -0,0 +1,53 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { centerImagePart } = require('../../util/Canvas');
module.exports = class ThreeThousandYearsCommand extends Command {
constructor(client) {
super(client, {
name: '3000-years',
aliases: ['3ky', '3k-years'],
group: 'edit-meme',
memberName: '3000-years',
description: 'Draws an image or a user\'s avatar over Pokémon\'s "It\'s been 3000 years" meme.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Pokémon',
url: 'https://www.pokemon.com/us/',
reason: 'Image, Original Game'
}
],
args: [
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 })
}
]
});
}
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', '3000-years.png'));
const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
const { x, y, width, height } = centerImagePart(data, 200, 200, 461, 127);
ctx.drawImage(data, x, y, width, height);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: '3000-years.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+59
View File
@@ -0,0 +1,59 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const path = require('path');
const { shortenText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'akbar.ttf'), { family: 'Akbar' });
module.exports = class LisaPresentationCommand extends Command {
constructor(client) {
super(client, {
name: 'bart-chalkboard',
aliases: ['bart', 'bart-chalk', 'bart-board'],
group: 'edit-meme',
memberName: 'bart-chalkboard',
description: 'Sends a "Bart Chalkboard" meme with the text of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: '20th Century Fox',
url: 'https://www.foxmovies.com/',
reason: 'Image, Original "The Simpsons" Show',
reasonURL: 'http://www.simpsonsworld.com/'
},
{
name: 'Jon Bernhardt',
url: 'http://web.mit.edu/jonb/www/',
reason: 'Akbar Font',
reasonURL: 'https://www.wobblymusic.com/groening/akbar.html'
}
],
args: [
{
key: 'text',
prompt: 'What should the text on the chalkboard be?',
type: 'string',
max: 50
}
]
});
}
async run(msg, { text }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'bart-chalkboard.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.textBaseline = 'top';
ctx.font = '19px Akbar';
ctx.fillStyle = 'white';
const shortened = shortenText(ctx, text.toUpperCase(), 500);
const arr = [];
for (let i = 0; i < 12; i++) arr.push(shortened);
ctx.fillText(arr.join('\n'), 30, 27);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'bart-chalkboard.png' }] });
}
};
+65
View File
@@ -0,0 +1,65 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { stripIndents } = require('common-tags');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
const texts = require('../../assets/json/be-like-bill');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'arialbd.ttf'), { family: 'Arial', weight: 'bold' });
module.exports = class BeLikeBillCommand extends Command {
constructor(client) {
super(client, {
name: 'be-like-bill',
aliases: ['be-like'],
group: 'edit-meme',
memberName: 'be-like-bill',
description: 'Sends a "Be Like Bill" meme with the name of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'gautamkrishnar',
url: 'https://github.com/gautamkrishnar/',
reason: 'Image',
reasonURL: 'https://github.com/gautamkrishnar/Be-Like-Bill'
},
{
name: 'Monotype',
url: 'https://www.monotype.com/',
reason: 'Arial Font',
reasonURL: 'https://catalog.monotype.com/family/monotype/arial'
}
],
args: [
{
key: 'name',
prompt: 'What should the name on the meme be?',
type: 'string',
default: 'Bill',
max: 20
}
]
});
}
async run(msg, { name }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'be-like-bill.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = 'normal bold 23px Arial';
const text = await wrapText(ctx, texts[Math.floor(Math.random() * texts.length)].replace(/{{name}}/gi, name), 569);
ctx.fillText(stripIndents`
This is ${name}.
${text.join('\n')}
${name} is smart.
Be like ${name}.
`, 31, 80);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'be-like-bill.png' }] });
}
};
+61
View File
@@ -0,0 +1,61 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
module.exports = class BeautifulCommand extends Command {
constructor(client) {
super(client, {
name: 'beautiful',
aliases: ['this-is-beautiful', 'grunkle-stan'],
group: 'edit-meme',
memberName: 'beautiful',
description: 'Draws a user\'s avatar over Gravity Falls\' "Oh, this? This is beautiful." meme.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Disney',
url: 'https://www.disney.com/',
reason: 'Original "Gravity Falls" Show',
reasonURL: 'https://disneynow.com/shows/gravity-falls'
},
{
name: 'Tatsumaki',
url: 'https://tatsumaki.xyz/',
reason: 'Image, Concept'
}
],
args: [
{
key: 'user',
prompt: 'Which user would you like to edit the avatar of?',
type: 'user',
default: msg => msg.author
}
]
});
}
async run(msg, { user }) {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 128 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'beautiful.png'));
const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.fillStyle = 'white';
ctx.fillRect(0, 0, base.width, base.height);
ctx.drawImage(avatar, 249, 24, 105, 105);
ctx.drawImage(avatar, 249, 223, 105, 105);
ctx.drawImage(base, 0, 0);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'beautiful.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+75
View File
@@ -0,0 +1,75 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { silhouette, hasAlpha, centerImagePart } = require('../../util/Canvas');
module.exports = class ChallengerCommand extends Command {
constructor(client) {
super(client, {
name: 'challenger',
aliases: ['challenger-approaching'],
group: 'edit-meme',
memberName: 'challenger',
description: 'Draws an image or a user\'s avatar over Smash Bros.\'s "Challenger Approaching" screen.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Jack The Awesomeness Gamer',
url: 'https://www.youtube.com/channel/UCIeA23B91hAeR1UuC2VDSdQ',
reason: 'Image',
reasonURL: 'https://www.youtube.com/watch?v=3FebRrXg0bk'
},
{
name: 'Nintendo',
url: 'https://www.nintendo.com/',
reason: 'Original "Super Smash Bros." Game',
reasonURL: 'https://www.smashbros.com/en_US/index.html'
}
],
args: [
{
key: 'silhouetted',
prompt: 'Should the image be silhouetted?',
type: 'boolean',
default: true
},
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 })
}
]
});
}
async run(msg, { image, silhouetted }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'challenger.png'));
const { body } = await request.get(image);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
const { x, y, width, height } = centerImagePart(avatar, 256, 256, 484, 98);
ctx.drawImage(silhouetted ? this.silhouetteImage(avatar) : avatar, x, y, width, height);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'challenger.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
silhouetteImage(image) {
if (!hasAlpha(image)) return image;
const canvas = createCanvas(image.width, image.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(image, 0, 0);
silhouette(ctx, 0, 0, image.width, image.height);
return canvas;
}
};
+53
View File
@@ -0,0 +1,53 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
module.exports = class CursedSpongeCommand extends Command {
constructor(client) {
super(client, {
name: 'cursed-sponge',
aliases: ['sponge-snail'],
group: 'edit-meme',
memberName: 'cursed-sponge',
description: 'Sends a cursed sponge duplicated however many times you want.',
throttling: {
usages: 1,
duration: 30
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Nickelodeon',
url: 'https://www.nick.com/',
reason: 'Image, Original "Spongebob Squarepants" Show',
reasonURL: 'https://www.nick.com/shows/spongebob-squarepants'
}
],
args: [
{
key: 'amount',
prompt: 'How many times do you want to duplicate the cursed sponge?',
type: 'integer',
max: 100,
min: 1
}
]
});
}
async run(msg, { amount }) {
const sponge = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'cursed-sponge.png'));
const rows = Math.ceil(amount / 10);
const canvas = createCanvas(sponge.width * (rows > 1 ? 10 : amount), sponge.height * rows);
const ctx = canvas.getContext('2d');
let width = 0;
for (let i = 0; i < amount; i++) {
const row = Math.ceil((i + 1) / 10);
ctx.drawImage(sponge, width, sponge.height * (row - 1));
if ((width + sponge.width) === (sponge.width * (rows > 1 ? 10 : amount))) width = 0;
else width += sponge.width;
}
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'cursed-sponge.png' }] });
}
};
+81
View File
@@ -0,0 +1,81 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Oswald-SemiBold.ttf'), { family: 'Oswald' });
module.exports = class DearLiberalsCommand extends Command {
constructor(client) {
super(client, {
name: 'dear-liberals',
aliases: ['turning-point-usa', 'ben-shapiro'],
group: 'edit-meme',
memberName: 'dear-liberals',
description: 'Sends a "Dear Liberals" meme with words of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Turning Point USA',
url: 'https://www.tpusa.com/',
reason: 'Image'
},
{
name: 'Google',
url: 'https://www.google.com/',
reason: 'Oswald Font',
reasonURL: 'https://fonts.google.com/specimen/Oswald'
}
],
args: [
{
key: 'hashtag',
prompt: 'What hashtag should be on Ben Shapiro\'s sign? No spaces or symbols.',
type: 'string',
max: 10,
validate: hashtag => /^[A-Z0-9]+$/i.test(hashtag)
},
{
key: 'blueText',
label: 'blue text',
prompt: 'What should the blue text be?',
type: 'string',
max: 42,
parse: blueText => blueText.toUpperCase()
},
{
key: 'redText',
label: 'red text',
prompt: 'What should the red text be?',
type: 'string',
max: 24,
parse: redText => redText.toUpperCase()
}
]
});
}
async run(msg, { hashtag, blueText, redText }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'dear-liberals.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.fillStyle = 'white';
ctx.textBaseline = 'top';
ctx.font = '20px Oswald SemiBold';
ctx.rotate(12.30 * (Math.PI / 180));
ctx.fillText(`#${hashtag}`, 200, 210);
ctx.rotate(-12.30 * (Math.PI / 180));
ctx.fillStyle = '#002046';
ctx.font = '27px Oswald SemiBold';
const blueLines = await wrapText(ctx, blueText, 270);
ctx.fillText(blueLines.join('\n'), 207, 90);
ctx.fillStyle = '#c31a41';
const redLines = await wrapText(ctx, redText, 165);
ctx.fillText(redLines.join('\n'), 326, 236);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'dear-liberals.png' }] });
}
};
+84
View File
@@ -0,0 +1,84 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { shortenText, centerImagePart } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class DemotivationalCommand extends Command {
constructor(client) {
super(client, {
name: 'demotivational',
aliases: ['demotivational-poster'],
group: 'edit-meme',
memberName: 'demotivational',
description: 'Draws an image or a user\'s avatar and the text you specify as a demotivational poster.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Google',
url: 'https://www.google.com/',
reason: 'Noto Font',
reasonURL: 'https://www.google.com/get/noto/'
}
],
args: [
{
key: 'title',
prompt: 'What should the title of the poster be?',
type: 'string',
max: 50,
parse: title => title.toUpperCase()
},
{
key: 'text',
prompt: 'What should the text of the poster be?',
type: 'string',
max: 100
},
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
});
}
async run(msg, { title, text, image }) {
try {
const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(750, 600);
const ctx = canvas.getContext('2d');
ctx.fillStyle = 'black';
ctx.fillRect(0, 0, canvas.width, canvas.height);
const { y, width, height } = centerImagePart(data, 602, 402, 0, 44);
const x = (canvas.width / 2) - (width / 2);
ctx.fillStyle = 'white';
ctx.fillRect(x - 4, y - 4, width + 8, height + 8);
ctx.fillStyle = 'black';
ctx.fillRect(x - 2, y - 2, width + 4, height + 4);
ctx.fillStyle = 'white';
ctx.fillRect(x, y, width, height);
ctx.drawImage(data, x, y, width, height);
ctx.textAlign = 'center';
ctx.font = '60px Noto';
ctx.fillStyle = 'aquamarine';
ctx.fillText(shortenText(ctx, title, 610), 375, 518);
ctx.font = '27px Noto';
ctx.fillStyle = 'white';
ctx.fillText(shortenText(ctx, text, 610), 375, 565);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'demotivational-poster.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
@@ -0,0 +1,75 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
module.exports = class DistractedBoyfriendCommand extends Command {
constructor(client) {
super(client, {
name: 'distracted-boyfriend',
aliases: ['man-looking-at-other-woman', 'jealous-girlfriend'],
group: 'edit-meme',
memberName: 'distracted-boyfriend',
description: 'Draws three user\'s avatars over the "Distracted Boyfriend" meme.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Antonio Guillem',
url: 'http://antonioguillem.com/',
reason: 'Image',
reasonURL: 'https://www.istockphoto.com/photo/gm493656728-77018851'
}
],
args: [
{
key: 'otherGirl',
label: 'other girl',
prompt: 'Which user should be the "other girl"?',
type: 'user'
},
{
key: 'girlfriend',
prompt: 'Which user should be the girlfriend?',
type: 'user'
},
{
key: 'boyfriend',
prompt: 'Which user should be the boyfriend?',
type: 'user'
}
]
});
}
async run(msg, { otherGirl, girlfriend, boyfriend }) {
const boyfriendAvatarURL = boyfriend.displayAvatarURL({ format: 'png', size: 256 });
const girlfriendAvatarURL = girlfriend.displayAvatarURL({ format: 'png', size: 256 });
const otherGirlAvatarURL = otherGirl.displayAvatarURL({ format: 'png', size: 256 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'distracted-boyfriend.png'));
const boyfriendAvatarData = await request.get(boyfriendAvatarURL);
const boyfriendAvatar = await loadImage(boyfriendAvatarData.body);
const girlfriendAvatarData = await request.get(girlfriendAvatarURL);
const girlfriendAvatar = await loadImage(girlfriendAvatarData.body);
const otherGirlAvatarData = await request.get(otherGirlAvatarURL);
const otherGirlAvatar = await loadImage(otherGirlAvatarData.body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.rotate(-18.06 * (Math.PI / 180));
ctx.drawImage(boyfriendAvatar, 290, 165, 125, 125);
ctx.rotate(18.06 * (Math.PI / 180));
ctx.rotate(3.11 * (Math.PI / 180));
ctx.drawImage(girlfriendAvatar, 539, 67, 100, 125);
ctx.rotate(-3.11 * (Math.PI / 180));
ctx.drawImage(otherGirlAvatar, 120, 96, 175, 175);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'distracted-boyfriend.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+61
View File
@@ -0,0 +1,61 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
module.exports = class DrakepostingCommand extends Command {
constructor(client) {
super(client, {
name: 'drakeposting',
aliases: ['drake'],
group: 'edit-meme',
memberName: 'drakeposting',
description: 'Draws two user\'s avatars over the "Drakeposting" meme.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Drake',
url: 'https://drakeofficial.com/',
reason: 'Original "Hotline Bling" Music Video',
reasonURL: 'https://youtu.be/uxpDa-c-4Mc'
}
],
args: [
{
key: 'nah',
prompt: 'Which user should be the "nah"?',
type: 'user'
},
{
key: 'yeah',
prompt: 'Which user should be the "yeah"?',
type: 'user'
}
]
});
}
async run(msg, { nah, yeah }) {
const nahAvatarURL = nah.displayAvatarURL({ format: 'png', size: 512 });
const yeahAvatarURL = yeah.displayAvatarURL({ format: 'png', size: 512 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'drakeposting.png'));
const nahAvatarData = await request.get(nahAvatarURL);
const nahAvatar = await loadImage(nahAvatarData.body);
const yeahAvatarData = await request.get(yeahAvatarURL);
const yeahAvatar = await loadImage(yeahAvatarData.body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.drawImage(nahAvatar, 512, 0, 512, 512);
ctx.drawImage(yeahAvatar, 512, 512, 512, 512);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'drakeposting.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+57
View File
@@ -0,0 +1,57 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { contrast } = require('../../util/Canvas');
module.exports = class FoodBrokeCommand extends Command {
constructor(client) {
super(client, {
name: 'food-broke',
aliases: ['food-machine-broke'],
group: 'edit-meme',
memberName: 'food-broke',
description: 'Draws a user\'s avatar over the "Food Broke" meme.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: '@liltusk',
url: 'https://twitter.com/liltusk',
reason: 'Image',
reasonURL: 'https://twitter.com/liltusk/status/835719948597137408'
}
],
args: [
{
key: 'user',
prompt: 'Which user would you like to edit the avatar of?',
type: 'user',
default: msg => msg.author
}
]
});
}
async run(msg, { user }) {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 128 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'food-broke.png'));
const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.drawImage(avatar, 23, 9, 125, 125);
contrast(ctx, 23, 9, 125, 125);
ctx.drawImage(avatar, 117, 382, 75, 75);
contrast(ctx, 117, 382, 75, 75);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'food-broke.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
@@ -0,0 +1,60 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { centerImagePart } = require('../../util/Canvas');
module.exports = class GirlWorthFightingForCommand extends Command {
constructor(client) {
super(client, {
name: 'girl-worth-fighting-for',
aliases: ['a-girl-worth-fighting-for', 'ling'],
group: 'edit-meme',
memberName: 'girl-worth-fighting-for',
description: 'Draws an image or a user\'s avatar as the object of Ling\'s affection.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Disney',
url: 'https://www.disney.com/',
reason: 'Original "Mulan" Movie',
reasonURL: 'https://movies.disney.com/mulan'
},
{
name: 'u/SupremeMemesXD',
url: 'https://www.reddit.com/user/SupremeMemesXD/',
reason: 'Image',
reasonURL: 'https://www.reddit.com/r/MemeTemplatesOfficial/comments/8h39vi/girl_worth_fighting_for_template/'
}
],
args: [
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 })
}
]
});
}
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'girl-worth-fighting-for.png'));
const { body } = await request.get(image);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
const { x, y, width, height } = centerImagePart(avatar, 150, 150, 380, 511);
ctx.drawImage(avatar, x, y, width, height);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'girl-worth-fighting-for.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+86
View File
@@ -0,0 +1,86 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
const coord = [[450, 129], [1200, 134], [450, 627], [1200, 627]];
module.exports = class GruPlanCommand extends Command {
constructor(client) {
super(client, {
name: 'gru-plan',
aliases: ['grus-plan', 'gru'],
group: 'edit-meme',
memberName: 'gru-plan',
description: 'Sends a Gru\'s Plan meme with steps of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Illumination',
url: 'http://www.illumination.com/',
reason: 'Original "Despicable Me" Movie',
reasonURL: 'http://www.despicable.me/'
},
{
name: 'Google',
url: 'https://www.google.com/',
reason: 'Noto Font',
reasonURL: 'https://www.google.com/get/noto/'
}
],
args: [
{
key: 'step1',
label: 'step 1',
prompt: 'What should the first step of Gru\'s plan be?',
type: 'string',
max: 150
},
{
key: 'step2',
label: 'step 2',
prompt: 'What should the second step of Gru\'s plan be?',
type: 'string',
max: 150
},
{
key: 'step3',
label: 'step 3',
prompt: 'What should the third step of Gru\'s plan be?',
type: 'string',
max: 150
}
]
});
}
async run(msg, { step1, step2, step3 }) {
const steps = [step1, step2, step3, step3];
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'gru-plan.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.fillStyle = 'black';
ctx.textBaseline = 'top';
let i = 0;
for (const [x, y] of coord) {
ctx.font = '35px Noto';
const step = steps[i];
let fontSize = 35;
while (ctx.measureText(step).width > 1100) {
fontSize -= 1;
ctx.font = `${fontSize}px Noto`;
}
const lines = await wrapText(ctx, step, 252);
ctx.fillText(lines.join('\n'), x, y);
i++;
}
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'gru-plan.png' }] });
}
};
+73
View File
@@ -0,0 +1,73 @@
const { Command } = require('discord.js-commando');
const { createCanvas, loadImage, registerFont } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class IllegalCommand extends Command {
constructor(client) {
super(client, {
name: 'illegal',
aliases: ['is-now-illegal', 'trump'],
group: 'edit-meme',
memberName: 'illegal',
description: 'Makes President Trump make your text illegal.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Donald J. Trump',
url: 'https://www.donaldjtrump.com/',
reason: 'Himself, Image'
},
{
name: 'Google',
url: 'https://www.google.com/',
reason: 'Noto Font',
reasonURL: 'https://www.google.com/get/noto/'
}
],
args: [
{
key: 'text',
prompt: 'What should the text of the bill be?',
type: 'string',
max: 20,
parse: text => text.toUpperCase()
},
{
key: 'verb',
prompt: 'Should the text use is, are, or am?',
type: 'string',
default: 'IS',
oneOf: ['is', 'are', 'am'],
parse: verb => verb.toUpperCase()
}
]
});
}
async run(msg, { text, verb }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'illegal.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.rotate(7 * (Math.PI / 180));
const illegalText = `${text} ${verb} NOW ILLEGAL.`;
let fontSize = 45;
ctx.font = `${fontSize}px Noto`;
while (ctx.measureText(illegalText).width > 550) {
fontSize -= 1;
ctx.font = `${fontSize}px Noto`;
}
const lines = await wrapText(ctx, illegalText, 200);
ctx.fillText(lines.join('\n'), 750, 290);
ctx.rotate(-7 * (Math.PI / 180));
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'illegal.png' }] });
}
};
+61
View File
@@ -0,0 +1,61 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
module.exports = class KyonGunCommand extends Command {
constructor(client) {
super(client, {
name: 'kyon-gun',
aliases: ['kyon-snapped', 'endless-eight'],
group: 'edit-meme',
memberName: 'kyon-gun',
description: 'Draws an image or a user\'s avatar behind Kyon shooting a gun.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'The Melancholy of Haruhi Suzumiya',
url: 'http://www.haruhi.tv/',
reason: 'Original Anime'
},
{
name: 'Know Your Meme',
url: 'https://knowyourmeme.com/',
reason: 'Image',
reasonURL: 'https://knowyourmeme.com/photos/217992-endless-eight-kyon-kun-denwa'
}
],
args: [
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
});
}
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'kyon-gun.png'));
const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.fillStyle = 'black';
ctx.fillRect(0, 0, base.width, base.height);
const ratio = data.width / data.height;
const width = Math.round(base.height * ratio);
ctx.drawImage(data, (base.width / 2) - (width / 2), 0, width, base.height);
ctx.drawImage(base, 0, 0);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'kyon-gun.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+66
View File
@@ -0,0 +1,66 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class LisaPresentationCommand extends Command {
constructor(client) {
super(client, {
name: 'lisa-presentation',
aliases: ['lisa'],
group: 'edit-meme',
memberName: 'lisa-presentation',
description: 'Sends a "Lisa Presentation" meme with the presentation of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: '20th Century Fox',
url: 'https://www.foxmovies.com/',
reason: 'Image, Original "The Simpsons" Show',
reasonURL: 'http://www.simpsonsworld.com/'
},
{
name: 'Google',
url: 'https://www.google.com/',
reason: 'Noto Font',
reasonURL: 'https://www.google.com/get/noto/'
}
],
args: [
{
key: 'text',
prompt: 'What should the text of the presentation be?',
type: 'string',
max: 500
}
]
});
}
async run(msg, { text }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'lisa-presentation.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.font = '40px Noto';
let fontSize = 40;
while (ctx.measureText(text).width > 1320) {
fontSize -= 1;
ctx.font = `${fontSize}px Noto`;
}
const lines = await wrapText(ctx, text, 330);
for (let i = 0; i < lines.length; i++) {
const textHeight = 95 + (i * fontSize) + (i * 10);
ctx.fillText(lines[i], base.width / 2, textHeight);
}
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'lisa-presentation.png' }] });
}
};
@@ -0,0 +1,54 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
module.exports = class LookAtThisPhotographCommand extends Command {
constructor(client) {
super(client, {
name: 'look-at-this-photograph',
aliases: ['nickelback', 'look-at-this-photo', 'photograph'],
group: 'edit-meme',
memberName: 'look-at-this-photograph',
description: 'Draws an image or a user\'s avatar over Nickelback\'s photograph.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Nickelback',
url: 'https://www.nickelback.com/',
reason: 'Image, Original "Photograph" Music Video',
reasonURL: 'https://www.youtube.com/watch?v=BB0DU4DoPP4'
}
],
args: [
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 })
}
]
});
}
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'look-at-this-photograph.png'));
const { body } = await request.get(image);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.rotate(-13.5 * (Math.PI / 180));
ctx.drawImage(avatar, 280, 218, 175, 125);
ctx.rotate(13.5 * (Math.PI / 180));
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'look-at-this-photograph.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+95
View File
@@ -0,0 +1,95 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Impact.ttf'), { family: 'Impact' });
module.exports = class MemeGenCommand extends Command {
constructor(client) {
super(client, {
name: 'meme-gen',
aliases: ['meme-generator', 'create-meme'],
group: 'edit-meme',
memberName: 'meme-gen',
description: 'Sends a meme with the text and background of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'ShareFonts.net',
url: 'https://www.wfonts.com/',
reason: 'Impact Font',
reasonURL: 'https://www.wfonts.com/font/impact'
}
],
args: [
{
key: 'top',
prompt: 'What should the top row of the meme to be?',
type: 'string',
max: 50,
parse: top => top.toUpperCase()
},
{
key: 'bottom',
prompt: 'What should the bottom row of the meme to be?',
type: 'string',
max: 50,
parse: bottom => bottom.toUpperCase()
},
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 2048 })
}
]
});
}
async run(msg, { top, bottom, image }) {
try {
const { body } = await request.get(image);
const base = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
const fontSize = Math.round(base.height / 10);
ctx.font = `${fontSize}px Impact`;
ctx.fillStyle = 'white';
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
const topLines = await wrapText(ctx, top, base.width - 10);
if (!topLines) return msg.reply('There\'s not enough width to make a meme with this image.');
for (let i = 0; i < topLines.length; i++) {
const textHeight = (i * fontSize) + (i * 10);
ctx.strokeStyle = 'black';
ctx.lineWidth = 5;
ctx.strokeText(topLines[i], base.width / 2, textHeight);
ctx.fillStyle = 'white';
ctx.fillText(topLines[i], base.width / 2, textHeight);
}
const bottomLines = await wrapText(ctx, bottom, base.width - 10);
if (!bottomLines) return msg.reply('There\'s not enough width to make a meme with this image.');
ctx.textBaseline = 'bottom';
const initial = base.height - ((bottomLines.length - 1) * fontSize) - ((bottomLines.length - 1) * 10);
for (let i = 0; i < bottomLines.length; i++) {
const textHeight = initial + (i * fontSize) + (i * 10);
ctx.strokeStyle = 'black';
ctx.lineWidth = 5;
ctx.strokeText(bottomLines[i], base.width / 2, textHeight);
ctx.fillStyle = 'white';
ctx.fillText(bottomLines[i], base.width / 2, textHeight);
}
const attachment = canvas.toBuffer();
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
return msg.say({ files: [{ attachment, name: 'meme-gen.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+57
View File
@@ -0,0 +1,57 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const path = require('path');
const { shortenText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class NewPasswordCommand extends Command {
constructor(client) {
super(client, {
name: 'new-password',
aliases: ['strong-password', 'new-pswd', 'strong-pswd'],
group: 'edit-meme',
memberName: 'new-password',
description: 'Sends a "Weak Password/Strong Password" meme with the passwords of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Google',
url: 'https://www.google.com/',
reason: 'Noto Font',
reasonURL: 'https://www.google.com/get/noto/'
}
],
args: [
{
key: 'weak',
prompt: 'What should the text of the weak password be?',
type: 'string',
max: 50
},
{
key: 'strong',
prompt: 'What should the text of the strong password be?',
type: 'string',
max: 50
}
]
});
}
async run(msg, { weak, strong }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'new-password.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '25px Noto';
ctx.fillText(shortenText(ctx, weak, 390), 40, 113);
ctx.fillText(shortenText(ctx, strong, 390), 40, 351);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'new-password.png' }] });
}
};
+90
View File
@@ -0,0 +1,90 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { wrapText, greyscale, drawImageWithTint } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class NikeAdCommand extends Command {
constructor(client) {
super(client, {
name: 'nike-ad',
aliases: ['believe-in-something', 'believe-in'],
group: 'edit-meme',
memberName: 'nike-ad',
description: 'Sends a "Believe in Something" Nike Ad meme with the text of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Nike',
url: 'https://www.nike.com/',
reason: 'Logo, Concept'
},
{
name: 'Google',
url: 'https://www.google.com/',
reason: 'Noto Font',
reasonURL: 'https://www.google.com/get/noto/'
}
],
args: [
{
key: 'something',
prompt: 'What should the something to believe in be?',
type: 'string',
max: 50
},
{
key: 'sacrifice',
prompt: 'What should believing result in (e.g. sacrificing everything)?',
type: 'string',
max: 50
},
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 2048 })
}
]
});
}
async run(msg, { image, something, sacrifice }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'nike-ad.png'));
const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
drawImageWithTint(ctx, data, 'black', 0, 0, data.width, data.height);
greyscale(ctx, 0, 0, data.width, data.height);
const ratio = base.width / base.height;
const width = data.width / 3;
const height = Math.round(width / ratio);
ctx.drawImage(base, (data.width / 2) - (width / 2), data.height - height, width, height);
const fontSize = Math.round(data.height / 25);
ctx.font = `${fontSize}px Noto`;
ctx.fillStyle = 'white';
ctx.textAlign = 'center';
const lines = await wrapText(ctx, `Believe in ${something}. Even if it means ${sacrifice}.`, data.width - 20);
if (!lines) return msg.reply('There\'s not enough width to make a Nike ad with this image.');
const initial = data.height / 2;
for (let i = 0; i < lines.length; i++) {
const textHeight = initial + (i * fontSize) + (i * 10);
ctx.fillText(lines[i], data.width / 2, textHeight);
}
const attachment = canvas.toBuffer();
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
return msg.say({ files: [{ attachment, name: 'nike-ad.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+86
View File
@@ -0,0 +1,86 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
const coord = [[240, 63], [689, 63], [705, 383], [220, 380]];
module.exports = class PlanktonPlanCommand extends Command {
constructor(client) {
super(client, {
name: 'plankton-plan',
aliases: ['planktons-plan', 'plankton'],
group: 'edit-meme',
memberName: 'plankton-plan',
description: 'Sends a Plankton\'s Plan meme with steps of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Nickelodeon',
url: 'https://www.nick.com/',
reason: 'Image, Original "Spongebob Squarepants" Show',
reasonURL: 'https://www.nick.com/shows/spongebob-squarepants'
},
{
name: 'Google',
url: 'https://www.google.com/',
reason: 'Noto Font',
reasonURL: 'https://www.google.com/get/noto/'
}
],
args: [
{
key: 'step1',
label: 'step 1',
prompt: 'What should the first step of Plankton\'s plan be?',
type: 'string',
max: 150
},
{
key: 'step2',
label: 'step 2',
prompt: 'What should the second step of Plankton\'s plan be?',
type: 'string',
max: 150
},
{
key: 'step3',
label: 'step 3',
prompt: 'What should the third step of Plankton\'s plan be?',
type: 'string',
max: 150
}
]
});
}
async run(msg, { step1, step2, step3 }) {
const steps = [step1, step2, step3, step3];
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'plankton-plan.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.fillStyle = 'black';
ctx.textBaseline = 'top';
let i = 0;
for (const [x, y] of coord) {
ctx.font = '35px Noto';
const step = steps[i];
let fontSize = 35;
while (ctx.measureText(step).width > 420) {
fontSize -= 1;
ctx.font = `${fontSize}px Noto`;
}
const lines = await wrapText(ctx, step, 155);
ctx.fillText(lines.join('\n'), x, y);
i++;
}
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'plankton-plan.png' }] });
}
};
+61
View File
@@ -0,0 +1,61 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
module.exports = class SoraSelfieCommand extends Command {
constructor(client) {
super(client, {
name: 'sora-selfie',
group: 'edit-meme',
memberName: 'sora-selfie',
description: 'Draws an image or a user\'s avatar behind Sora taking a selfie.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Square Enix',
url: 'https://square-enix-games.com/',
reason: 'Original "Kingdom Hearts" Game',
reasonURL: 'https://www.kingdomhearts.com/home/us/'
},
{
name: '@Candasaurus',
url: 'https://twitter.com/Candasaurus',
reason: 'Image',
reasonURL: 'https://twitter.com/Candasaurus/status/1041946636656599045'
}
],
args: [
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
});
}
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'sora-selfie.png'));
const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.fillStyle = 'black';
ctx.fillRect(0, 0, base.width, base.height);
const ratio = data.width / data.height;
const width = Math.round(base.height * ratio);
ctx.drawImage(data, (base.width / 2) - (width / 2), 0, width, base.height);
ctx.drawImage(base, 0, 0);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'sora-selfie.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+64
View File
@@ -0,0 +1,64 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class SosCommand extends Command {
constructor(client) {
super(client, {
name: 'sos',
aliases: ['esther-verkest', 'esther', 'help-sign'],
group: 'edit-meme',
memberName: 'sos',
description: 'Sends a "Esther Verkest\'s Help Sign" comic with the text of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Esther Verkest',
url: 'https://www.facebook.com/Esther-Verkest-49667161749/',
reason: 'Image'
},
{
name: 'Google',
url: 'https://www.google.com/',
reason: 'Noto Font',
reasonURL: 'https://www.google.com/get/noto/'
}
],
args: [
{
key: 'message',
prompt: 'What should Esther spell out to signal for help?',
type: 'string',
max: 10
}
]
});
}
async run(msg, { message }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'sos.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '90px Noto';
ctx.fillStyle = 'black';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.rotate(15 * (Math.PI / 180));
let fontSize = 90;
while (ctx.measureText(message).width > 140) {
fontSize -= 1;
ctx.font = `${fontSize}px Noto`;
}
ctx.fillText(message.toUpperCase(), 362, 522);
ctx.rotate(-15 * (Math.PI / 180));
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'sos.png' }] });
}
};
+76
View File
@@ -0,0 +1,76 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class SpongebobBurnCommand extends Command {
constructor(client) {
super(client, {
name: 'spongebob-burn',
aliases: ['sponge-burn', 'spongebob-fire', 'sponge-fire'],
group: 'edit-meme',
memberName: 'spongebob-burn',
description: 'Sends a "Spongebob Throwing Something into a Fire" meme with words of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Nickelodeon',
url: 'https://www.nick.com/',
reason: 'Image, Original "Spongebob Squarepants" Show',
reasonURL: 'https://www.nick.com/shows/spongebob-squarepants'
},
{
name: 'Google',
url: 'https://www.google.com/',
reason: 'Noto Font',
reasonURL: 'https://www.google.com/get/noto/'
}
],
args: [
{
key: 'burn',
label: 'thing to burn',
prompt: 'What should Spongebob burn?',
type: 'string',
max: 150
},
{
key: 'person',
prompt: 'What should Spongebob be labelled as?',
type: 'string',
max: 15
}
]
});
}
async run(msg, { burn, person }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'spongebob-burn.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.fillStyle = 'black';
ctx.textBaseline = 'top';
ctx.font = '35px Noto';
let fontSize = 35;
while (ctx.measureText(burn).width > 400) {
fontSize -= 1;
ctx.font = `${fontSize}px Noto`;
}
const lines = await wrapText(ctx, burn, 180);
ctx.fillText(lines.join('\n'), 55, 103);
ctx.font = '25px Noto';
ctx.fillText(person, 382, 26);
ctx.font = '20px Noto';
ctx.fillText(person, 119, 405);
ctx.fillText(person, 439, 434);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'spongebob-burn.png' }] });
}
};
+58
View File
@@ -0,0 +1,58 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { greyscale } = require('../../util/Canvas');
module.exports = class ThugLifeCommand extends Command {
constructor(client) {
super(client, {
name: 'thug-life',
group: 'edit-meme',
memberName: 'thug-life',
description: 'Draws "Thug Life" over an image or a user\'s avatar.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'pngimg.com',
url: 'https://pngimg.com/',
reason: 'Image',
reasonURL: 'http://pngimg.com/download/58231'
}
],
args: [
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 2048 })
}
]
});
}
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'thug-life.png'));
const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(data, 0, 0);
greyscale(ctx, 0, 0, data.width, data.height);
const ratio = base.width / base.height;
const width = data.width / 2;
const height = Math.round(width / ratio);
ctx.drawImage(base, (data.width / 2) - (width / 2), data.height - height, width, height);
const attachment = canvas.toBuffer();
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
return msg.say({ files: [{ attachment, name: 'thug-life.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+56
View File
@@ -0,0 +1,56 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { drawImageWithTint } = require('../../util/Canvas');
module.exports = class ToBeContinuedCommand extends Command {
constructor(client) {
super(client, {
name: 'to-be-continued',
group: 'edit-meme',
memberName: 'to-be-continued',
description: 'Draws an image with the "To Be Continued..." arrow.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'JoJo\'s Bizzare Adventure',
url: 'http://www.araki-jojo.com/',
reason: 'Original Anime'
}
],
args: [
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
});
}
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'to-be-continued.png'));
const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
drawImageWithTint(ctx, data, '#704214', 0, 0, data.width, data.height);
const ratio = base.width / base.height;
const width = canvas.width / 2;
const height = Math.round(width / ratio);
ctx.drawImage(base, 0, canvas.height - height, width, height);
const attachment = canvas.toBuffer();
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
return msg.say({ files: [{ attachment, name: 'to-be-continued.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+61
View File
@@ -0,0 +1,61 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { centerImagePart } = require('../../util/Canvas');
module.exports = class UltimateTattooCommand extends Command {
constructor(client) {
super(client, {
name: 'ultimate-tattoo',
aliases: ['the-ultimate-tattoo', 'tattoo'],
group: 'edit-meme',
memberName: 'ultimate-tattoo',
description: 'Draws an image or a user\'s avatar as "The Ultimate Tattoo".',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Deathbulge',
url: 'http://deathbulge.com/comics',
reason: 'Image',
reasonURL: 'http://deathbulge.com/comics/114'
},
{
name: 'YorkAARGH',
url: 'https://github.com/YorkAARGH',
reason: 'Concept'
}
],
args: [
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 })
}
]
});
}
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'ultimate-tattoo.png'));
const { body } = await request.get(image);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.rotate(-10 * (Math.PI / 180));
const { x, y, width, height } = centerImagePart(avatar, 300, 300, 84, 690);
ctx.drawImage(avatar, x, y, width, height);
ctx.rotate(10 * (Math.PI / 180));
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'ultimate-tattoo.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+56
View File
@@ -0,0 +1,56 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
module.exports = class VietnamFlashbacksCommand extends Command {
constructor(client) {
super(client, {
name: 'vietnam-flashbacks',
aliases: ['nam-flashbacks', 'vietnam'],
group: 'edit-meme',
memberName: 'vietnam-flashbacks',
description: 'Edits Vietnam flashbacks behind an image or a user\'s avatar.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Horst Faas',
url: 'https://en.wikipedia.org/wiki/Horst_Faas',
reason: 'Image'
}
],
args: [
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 2048 })
}
]
});
}
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'vietnam-flashbacks.png'));
const { body } = await request.get(image);
const data = await loadImage(body);
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
const ratio = base.width / base.height;
const width = Math.round(data.height * ratio);
ctx.drawImage(base, (data.width / 2) - (width / 2), 0, width, data.height);
ctx.globalAlpha = 0.675;
ctx.drawImage(data, 0, 0);
const attachment = canvas.toBuffer();
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
return msg.say({ files: [{ attachment, name: 'vietnam-flashbacks.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+62
View File
@@ -0,0 +1,62 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { centerImagePart } = require('../../util/Canvas');
module.exports = class WorthlessCommand extends Command {
constructor(client) {
super(client, {
name: 'worthless',
aliases: ['this-is-worthless'],
group: 'edit-meme',
memberName: 'worthless',
description: 'Draws an image or a user\'s avatar over Gravity Falls\' "This is worthless." meme.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Disney',
url: 'https://www.disney.com/',
reason: 'Original "Gravity Falls" Show',
reasonURL: 'https://disneynow.com/shows/gravity-falls'
}
],
args: [
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
});
}
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'worthless.png'));
const { body } = await request.get(image);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.rotate(6 * (Math.PI / 180));
const center1 = centerImagePart(avatar, 400, 400, 496, 183);
ctx.drawImage(avatar, center1.x, center1.y, center1.width, center1.height);
ctx.rotate(-6 * (Math.PI / 180));
ctx.translate(canvas.width / 2, canvas.height / 2);
ctx.rotate(160 * (Math.PI / 180));
ctx.translate(-(canvas.width / 2), -(canvas.height / 2));
const center2 = centerImagePart(avatar, 75, 75, 625, 55);
ctx.drawImage(avatar, center2.x, center2.y, center2.width, center2.height);
ctx.rotate(-160 * (Math.PI / 180));
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'worthless.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};