mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
I have the power command
This commit is contained in:
|
Before Width: | Height: | Size: 174 KiB After Width: | Height: | Size: 174 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
@@ -3,13 +3,13 @@ const { createCanvas, loadImage } = require('canvas');
|
||||
const snekfetch = require('snekfetch');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class SimbaCommand extends Command {
|
||||
module.exports = class HeLivesInYouCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'simba',
|
||||
aliases: ['mufasa', 'he-lives-in-you'],
|
||||
name: 'he-lives-in-you',
|
||||
aliases: ['mufasa', 'simba'],
|
||||
group: 'avatar-edit',
|
||||
memberName: 'simba',
|
||||
memberName: 'he-lives-in-you',
|
||||
description: 'Draws a user\'s avatar over Simba from The Lion King\'s reflection.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
@@ -36,14 +36,14 @@ module.exports = class SimbaCommand extends Command {
|
||||
try {
|
||||
const canvas = createCanvas(500, 281);
|
||||
const ctx = canvas.getContext('2d');
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'simba.png'));
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'he-lives-in-you.png'));
|
||||
const { body } = await snekfetch.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.rotate(-24 * (Math.PI / 180));
|
||||
ctx.drawImage(avatar, 75, 160, 130, 150);
|
||||
ctx.rotate(24 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'simba.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'he-lives-in-you.png' }] });
|
||||
} catch (err) {
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const snekfetch = require('snekfetch');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class IHaveThePowerCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'i-have-the-power',
|
||||
aliases: ['he-man'],
|
||||
group: 'avatar-edit',
|
||||
memberName: 'i-have-the-power',
|
||||
description: 'Draws a user\'s avatar over He-Man\'s face.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 15
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: ''
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
if (!user) user = msg.author;
|
||||
const avatarURL = user.displayAvatarURL({
|
||||
format: 'png',
|
||||
size: 512
|
||||
});
|
||||
try {
|
||||
const canvas = createCanvas(720, 536);
|
||||
const ctx = canvas.getContext('2d');
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'i-have-the-power.png'));
|
||||
const { body } = await snekfetch.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.rotate(18.3 * (Math.PI / 180));
|
||||
ctx.drawImage(avatar, 322, 6, 371, 371);
|
||||
ctx.rotate(-18.3 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'i-have-the-power.png' }] });
|
||||
} catch (err) {
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "42.14.2",
|
||||
"version": "42.15.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Shard.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user