mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-07 14:55:40 +02:00
Fix some variable names
This commit is contained in:
@@ -38,13 +38,13 @@ module.exports = class DexterCommand extends Command {
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'dexter.png'));
|
||||
const { body } = await request.get(image);
|
||||
const avatar = await loadImage(body);
|
||||
const data = 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));
|
||||
const { x, y, width, height } = centerImagePart(avatar, 225, 225, 234, 274);
|
||||
ctx.drawImage(avatar, x, y, width, height);
|
||||
const { x, y, width, height } = centerImagePart(data, 225, 225, 234, 274);
|
||||
ctx.drawImage(data, x, y, width, height);
|
||||
ctx.rotate(11 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'dexter.png' }] });
|
||||
} catch (err) {
|
||||
|
||||
@@ -52,12 +52,12 @@ module.exports = class ChallengerCommand extends Command {
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'challenger.png'));
|
||||
const { body } = await request.get(image);
|
||||
const avatar = await loadImage(body);
|
||||
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(avatar, 256, 256, 484, 98);
|
||||
ctx.drawImage(silhouetted ? this.silhouetteImage(avatar) : avatar, x, y, width, height);
|
||||
const { x, y, width, height } = centerImagePart(data, 256, 256, 484, 98);
|
||||
ctx.drawImage(silhouetted ? this.silhouetteImage(data) : data, 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!`);
|
||||
|
||||
@@ -46,12 +46,12 @@ module.exports = class GirlWorthFightingForCommand extends Command {
|
||||
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 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(avatar, 150, 150, 380, 511);
|
||||
ctx.drawImage(avatar, x, y, width, height);
|
||||
const { x, y, width, height } = centerImagePart(data, 150, 150, 380, 511);
|
||||
ctx.drawImage(data, 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!`);
|
||||
|
||||
@@ -39,12 +39,12 @@ module.exports = class LookAtThisPhotographCommand extends Command {
|
||||
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 data = 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.drawImage(data, 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) {
|
||||
|
||||
@@ -40,14 +40,14 @@ module.exports = class MyCollectionGrowsCommand extends Command {
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'my-collection-grows.png'));
|
||||
const { body } = await request.get(image);
|
||||
const avatar = await loadImage(body);
|
||||
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(-14 * (Math.PI / 180));
|
||||
const { x, y, width, height } = centerImagePart(avatar, 425, 425, 145, 179);
|
||||
ctx.drawImage(avatar, x, y, width, height);
|
||||
const { x, y, width, height } = centerImagePart(data, 425, 425, 145, 179);
|
||||
ctx.drawImage(data, x, y, width, height);
|
||||
ctx.rotate(14 * (Math.PI / 180));
|
||||
ctx.drawImage(base, 0, 0);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'my-collection-grows.png' }] });
|
||||
|
||||
@@ -45,13 +45,13 @@ module.exports = class UltimateTattooCommand extends Command {
|
||||
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 data = 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);
|
||||
const { x, y, width, height } = centerImagePart(data, 300, 300, 84, 690);
|
||||
ctx.drawImage(data, x, y, width, height);
|
||||
ctx.rotate(10 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'ultimate-tattoo.png' }] });
|
||||
} catch (err) {
|
||||
|
||||
@@ -40,19 +40,19 @@ module.exports = class WorthlessCommand extends Command {
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'worthless.png'));
|
||||
const { body } = await request.get(image);
|
||||
const avatar = await loadImage(body);
|
||||
const data = 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);
|
||||
const center1 = centerImagePart(data, 400, 400, 496, 183);
|
||||
ctx.drawImage(data, 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);
|
||||
const center2 = centerImagePart(data, 75, 75, 625, 55);
|
||||
ctx.drawImage(data, 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) {
|
||||
|
||||
Reference in New Issue
Block a user