Support images is bob-ross, steam-card, wanted, look-what-karen-have

This commit is contained in:
Dragon Fire
2020-07-06 10:22:26 -04:00
parent c6a3bec3ac
commit f4b66966c7
6 changed files with 61 additions and 53 deletions
+4 -4
View File
@@ -580,6 +580,7 @@ Total: 529
* **approved:** Draws an "approved" stamp over an image or a user's avatar.
* **axis-cult-sign-up:** Sends an Axis Cult Sign-Up sheet for you. Join today!
* **blur:** Draws an image or a user's avatar but blurred.
* **bob-ross:** Draws an image or a user's avatar over Bob Ross' canvas.
* **brazzers:** Draws an image with the Brazzers logo in the corner. (NSFW)
* **caution:** Creates a caution sign with the text of your choice.
* **certificate:** Sends a certificate of excellence with the name and reason of your choice.
@@ -636,11 +637,13 @@ Total: 529
* **spongebob-time-card:** Sends a Spongebob Time Card with the text of your choice.
* **square:** Draws an image or a user's avatar as a square.
* **squish:** Draws an image or a user's avatar but squished across the X or Y axis.
* **steam-card:** Draws an image or a user's avatar on a Steam Trading Card.
* **subtitle:** Adds subtitles to an image.
* **swirl:** Draws an image or a user's avatar but swirled.
* **tint:** Draws an image or a user's avatar but tinted a specific color.
* **tweet:** Sends a Twitter tweet with the user and text of your choice.
* **undertale:** Sends a text box from Undertale with the quote and character of your choice.
* **wanted:** Draws an image or a user's avatar over a wanted poster.
* **wild-pokemon:** Draws an image or a user's avatar over a wild Pokémon appearance.
* **you-died:** Sends a "You Died" screen over an image or a user's avatar.
* **yu-gi-oh-gen:** Draws an image or a user's avatar on a Yu-Gi-Oh! Trading Card with the text of your choice.
@@ -650,22 +653,18 @@ Total: 529
### Avatar Manipulation:
* **avatar-fusion:** Draws a a user's avatar over a user's avatar.
* **bob-ross:** Draws a user's avatar over Bob Ross' canvas.
* **chocolate-milk:** Draws a user's avatar holding chocolate milk.
* **fire:** Burns a user's avatar.
* **hat:** Draws a hat over a user's avatar.
* **he-lives-in-you:** Draws a user's avatar over Simba from The Lion King's reflection.
* **hearts:** Draws hearts around a user's avatar.
* **i-have-the-power:** Draws a user's avatar over He-Man's face.
* **look-what-karen-have:** Draws a user's avatar over Karen's piece of paper.
* **rip:** Draws a user's avatar over a gravestone.
* **sip:** Draws a user's avatar sipping tea.
* **status-button:** Creates a Discord status button from c99.nl.
* **steam-card:** Draws a user's avatar on a Steam Trading Card.
* **steam-now-playing-classic:** Draws a user's avatar over a Steam "now playing" notification (old skin).
* **steam-now-playing:** Draws a user's avatar over a Steam "now playing" notification.
* **triggered:** Draws a user's avatar over the "Triggered" meme.
* **wanted:** Draws a user's avatar over a wanted poster.
### Meme Generators:
@@ -700,6 +699,7 @@ Total: 529
* **like:** Sends an "Everyone Liked That" meme with the image of your choice.
* **lisa-presentation:** Sends a "Lisa Presentation" meme with the presentation of your choice.
* **look-at-this-photograph:** Draws an image or a user's avatar over Nickelback's photograph.
* **look-what-karen-have:** Draws an image or a user's avatar over Karen's piece of paper.
* **mario-bros-views:** Sends a "Mario Bros. Views" meme with the text of your choice.
* **meme-gen-classic:** Sends a meme with the text and background of your choice.
* **meme-gen-modern:** Sends a meme with the text and image of your choice.
@@ -2,15 +2,16 @@ 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 BobRossCommand extends Command {
constructor(client) {
super(client, {
name: 'bob-ross',
aliases: ['ross'],
group: 'edit-avatar',
group: 'edit-image',
memberName: 'bob-ross',
description: 'Draws a user\'s avatar over Bob Ross\' canvas.',
description: 'Draws an image or a user\'s avatar over Bob Ross\' canvas.',
throttling: {
usages: 1,
duration: 10
@@ -31,26 +32,26 @@ module.exports = class BobRossCommand extends Command {
],
args: [
{
key: 'user',
prompt: 'Which user would you like to edit the avatar of?',
type: 'user',
default: msg => msg.author
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
});
}
async run(msg, { user }) {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'bob-ross.png'));
const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
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 = 'white';
ctx.fillRect(0, 0, base.width, base.height);
ctx.drawImage(avatar, 15, 20, 440, 440);
const { x, y, width, height } = centerImagePart(data, 440, 440, 15, 20);
ctx.drawImage(data, x, y, width, height);
ctx.drawImage(base, 0, 0);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'bob-ross.png' }] });
} catch (err) {
@@ -11,9 +11,9 @@ module.exports = class SteamCardCommand extends Command {
super(client, {
name: 'steam-card',
aliases: ['valve-card'],
group: 'edit-avatar',
group: 'edit-image',
memberName: 'steam-card',
description: 'Draws a user\'s avatar on a Steam Trading Card.',
description: 'Draws an image or a user\'s avatar on a Steam Trading Card.',
throttling: {
usages: 1,
duration: 10
@@ -41,32 +41,38 @@ module.exports = class SteamCardCommand extends Command {
],
args: [
{
key: 'user',
prompt: 'Which user would you like to edit the avatar of?',
type: 'user',
default: msg => msg.author
key: 'name',
prompt: 'What do you want the card to be named?',
type: 'string',
max: 50
},
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 })
}
]
});
}
async run(msg, { user }) {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
async run(msg, { name, image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'steam-card.png'));
const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
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 = '#feb2c1';
ctx.fillRect(0, 0, base.width, base.height);
ctx.drawImage(avatar, 12, 19, 205, 205);
const height = 205 / data.width;
ctx.drawImage(data, 12, 19, 205, height * data.height);
ctx.drawImage(base, 0, 0);
ctx.font = '14px Noto';
ctx.fillStyle = 'black';
ctx.fillText(user.username, 16, 25);
ctx.fillText(name, 16, 25);
ctx.fillStyle = 'white';
ctx.fillText(user.username, 15, 24);
ctx.fillText(name, 15, 24);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-card.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
@@ -2,16 +2,16 @@ const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { sepia } = require('../../util/Canvas');
const { sepia, centerImagePart } = require('../../util/Canvas');
module.exports = class WantedCommand extends Command {
constructor(client) {
super(client, {
name: 'wanted',
aliases: ['wanted-poster'],
group: 'edit-avatar',
group: 'edit-image',
memberName: 'wanted',
description: 'Draws a user\'s avatar over a wanted poster.',
description: 'Draws an image or a user\'s avatar over a wanted poster.',
throttling: {
usages: 1,
duration: 10
@@ -27,26 +27,26 @@ module.exports = class WantedCommand extends Command {
],
args: [
{
key: 'user',
prompt: 'Which user would you like to edit the avatar of?',
type: 'user',
default: msg => msg.author
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
});
}
async run(msg, { user }) {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'wanted.png'));
const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
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);
ctx.drawImage(avatar, 150, 360, 430, 430);
sepia(ctx, 150, 360, 430, 430);
const { x, y, width, height } = centerImagePart(data, 430, 430, 150, 360);
ctx.drawImage(data, x, y, width, height);
sepia(ctx, x, y, width, height);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'wanted.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
@@ -2,15 +2,16 @@ 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 LookWhatKarenHaveCommand extends Command {
constructor(client) {
super(client, {
name: 'look-what-karen-have',
aliases: ['look-at-what-karen-has', 'look-what-karen-has'],
group: 'edit-avatar',
group: 'edit-meme',
memberName: 'look-what-karen-have',
description: 'Draws a user\'s avatar over Karen\'s piece of paper.',
description: 'Draws an image or a user\'s avatar over Karen\'s piece of paper.',
throttling: {
usages: 1,
duration: 10
@@ -31,27 +32,27 @@ module.exports = class LookWhatKarenHaveCommand extends Command {
],
args: [
{
key: 'user',
prompt: 'Which user would you like to edit the avatar of?',
type: 'user',
default: msg => msg.author
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
});
}
async run(msg, { user }) {
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
async run(msg, { image }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'look-what-karen-have.png'));
const { body } = await request.get(avatarURL);
const avatar = await loadImage(body);
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 = 'white';
ctx.fillRect(0, 0, base.width, base.height);
ctx.rotate(-6.5 * (Math.PI / 180));
ctx.drawImage(avatar, 514, 50, 512, 512);
const { x, y, width, height } = centerImagePart(data, 512, 512, 514, 50);
ctx.drawImage(data, x, y, width, height);
ctx.rotate(6.5 * (Math.PI / 180));
ctx.drawImage(base, 0, 0);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'look-what-karen-have.png' }] });
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "119.10.0",
"version": "119.10.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {