mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 10:02:05 +02:00
Allow many more memes to support all images
This commit is contained in:
@@ -1,74 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { silhouette } = require('../../util/Canvas');
|
||||
|
||||
module.exports = class ChallengerCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'challenger',
|
||||
aliases: ['challenger-approaching'],
|
||||
group: 'avatar-edit',
|
||||
memberName: 'challenger',
|
||||
description: 'Draws a user\'s avatar over Super 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: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
},
|
||||
{
|
||||
key: 'silhouetted',
|
||||
prompt: 'Should the image be silhouetted?',
|
||||
type: 'boolean',
|
||||
default: false
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user, silhouetted }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'challenger.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(silhouetted ? this.silhouetteImage(avatar) : avatar, 484, 98, 256, 256);
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
};
|
||||
@@ -1,53 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class DexterCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'dexter',
|
||||
group: 'avatar-edit',
|
||||
memberName: 'dexter',
|
||||
description: 'Draws a user\'s avatar over the screen of Dexter from Pokémon.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Pokémon',
|
||||
url: 'https://www.pokemon.com/us/',
|
||||
reason: 'Image, Original Anime'
|
||||
}
|
||||
],
|
||||
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: 256 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'dexter.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.rotate(-11 * (Math.PI / 180));
|
||||
ctx.drawImage(avatar, 234, 274, 225, 225);
|
||||
ctx.rotate(11 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'dexter.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,55 +0,0 @@
|
||||
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: 'avatar-edit',
|
||||
memberName: 'look-at-this-photograph',
|
||||
description: 'Draws 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: '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: 256 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'look-at-this-photograph.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.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!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user