mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Cursed Sponge Command
This commit is contained in:
@@ -53,7 +53,7 @@ Xiao is a Discord bot coded in JavaScript with
|
||||
6. Run `npm i -g pm2` to install PM2.
|
||||
7. Run `pm2 start Xiao.js --name xiao` to run the bot.
|
||||
|
||||
## Commands (343)
|
||||
## Commands (344)
|
||||
### Utility:
|
||||
|
||||
* **eval:** Executes JavaScript code.
|
||||
@@ -291,6 +291,7 @@ Xiao is a Discord bot coded in JavaScript with
|
||||
* **color:** Sends an image of the color you choose.
|
||||
* **contrast:** Draws an image or a user's avatar but with contrast.
|
||||
* **create-qr-code:** Converts text to a QR Code.
|
||||
* **cursed-sponge:** Sends a cursed sponge duplicated however many times you want.
|
||||
* **demotivational:** Draws an image or a user's avatar and the text you specify as a demotivational poster.
|
||||
* **distort:** Draws an image or a user's avatar but distorted.
|
||||
* **fire:** Draws a fiery border over an image or a user's avatar.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
@@ -0,0 +1,44 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class CursedSpongeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'cursed-sponge',
|
||||
aliases: ['sponge-snail'],
|
||||
group: 'image-edit',
|
||||
memberName: 'cursed-sponge',
|
||||
description: 'Sends a cursed sponge duplicated however many times you want.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 30
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
args: [
|
||||
{
|
||||
key: 'amount',
|
||||
prompt: 'How many times do you want to duplicate the cursed sponge?',
|
||||
type: 'integer',
|
||||
max: 100
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { amount }) {
|
||||
const sponge = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'cursed-sponge.png'));
|
||||
const rows = Math.ceil(10 / amount);
|
||||
const canvas = createCanvas(sponge.width * (rows > 1 ? 10 : amount), sponge.height * rows);
|
||||
const ctx = canvas.getContext('2d');
|
||||
let width = 0;
|
||||
for (let i = 0; i < amount; i++) {
|
||||
const row = Math.ceil((i + 1) / 10);
|
||||
ctx.drawImage(sponge, width, sponge.height * row);
|
||||
if ((width + sponge.width) === (sponge.width * (rows > 1 ? 10 : amount))) width = 0;
|
||||
else width += sponge.width;
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'cursed-sponge.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "107.2.0",
|
||||
"version": "107.3.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user