Cursed Sponge Command

This commit is contained in:
Dragon Fire
2019-07-23 20:59:07 -04:00
parent 2f55ceff2c
commit deabf68c6f
4 changed files with 47 additions and 2 deletions
+2 -1
View File
@@ -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

+44
View File
@@ -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
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "107.2.0",
"version": "107.3.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {