mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Brazzers logo command
This commit is contained in:
@@ -47,7 +47,7 @@ Xiao is a Discord bot coded in JavaScript with
|
||||
7. Run `npm i -g pm2` to install PM2.
|
||||
8. Run `pm2 start Xiao.js --name xiao` to run the bot.
|
||||
|
||||
## Commands (332)
|
||||
## Commands (333)
|
||||
### Utility:
|
||||
|
||||
* **eval:** Executes JavaScript code.
|
||||
@@ -280,6 +280,7 @@ Xiao is a Discord bot coded in JavaScript with
|
||||
* **achievement:** Sends a Minecraft achievement with the text of your choice.
|
||||
* **approved:** Draws an "approved" stamp over an image or a user's avatar.
|
||||
* **be-like-bill:** Sends a "Be Like Bill" meme with the name of your choice.
|
||||
* **brazzers:** Draws an image with the Brazzers logo in the corner.
|
||||
* **circle:** Draws an image or a user's avatar as a circle.
|
||||
* **color:** Sends an image of the color you choose.
|
||||
* **contrast:** Draws an image or a user's avatar but with contrast.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.5 KiB |
@@ -0,0 +1,48 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class BrazzersCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'brazzers',
|
||||
group: 'image-edit',
|
||||
memberName: 'brazzers',
|
||||
description: 'Draws an image with the Brazzers logo in the corner.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
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', 'brazzers.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);
|
||||
const ratio = base.width / base.height;
|
||||
const width = data.width / 4;
|
||||
const height = Math.round(width / ratio);
|
||||
ctx.drawImage(base, data.width - width, 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: 'brazzers.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "101.1.2",
|
||||
"version": "101.2.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user