GIF Fire Command
@@ -224,7 +224,7 @@ in the appropriate channel's topic to use it.
|
||||
|
||||
## Commands
|
||||
|
||||
Total: 454
|
||||
Total: 455
|
||||
|
||||
### Utility:
|
||||
|
||||
@@ -535,7 +535,7 @@ Total: 454
|
||||
* **create-qr-code:** Converts text to a QR Code.
|
||||
* **dexter:** Draws an image or a user's avatar over the screen of Dexter from Pokémon.
|
||||
* **distort:** Draws an image or a user's avatar but distorted.
|
||||
* **fire:** Draws a fiery border over an image or a user's avatar.
|
||||
* **fire-frame:** Draws a fiery border over an image or a user's avatar.
|
||||
* **fish-eye:** Draws an image or a user's avatar but with a fish-eye lens.
|
||||
* **frame:** Draws a frame around an image or a user's avatar.
|
||||
* **ghost:** Draws an image or a user's avatar but with a ghost-like transparency.
|
||||
@@ -574,6 +574,7 @@ Total: 454
|
||||
* **avatar-fusion:** Draws a a user's avatar over a user's avatar.
|
||||
* **bob-ross:** Draws a user's avatar over Bob Ross' canvas.
|
||||
* **chocolate-milk:** Draws a user's avatar holding chocolate milk.
|
||||
* **fire:** Burns a user's avatar.
|
||||
* **hat:** Draws a hat over a user's avatar.
|
||||
* **he-lives-in-you:** Draws a user's avatar over Simba from The Lion King's reflection.
|
||||
* **hearts:** Draws hearts around a user's avatar.
|
||||
@@ -1115,6 +1116,8 @@ here.
|
||||
* lorem-picsum (API)
|
||||
- [LoveToKnow](https://www.lovetoknow.com/)
|
||||
* horse-race ([Horse Name Data](https://horses.lovetoknow.com/horse-names/funny-horse-names))
|
||||
- [LowGif](http://www.lowgif.com/)
|
||||
* fire ([Images](http://www.lowgif.com/43360ebce9150f23.html))
|
||||
- [Mad Libs](http://www.madlibs.com/)
|
||||
* mad-libs (Original Game)
|
||||
- [Mad:)Takes](https://www.madtakes.com/index.php)
|
||||
@@ -1347,7 +1350,7 @@ here.
|
||||
- [Superpower Wiki](https://powerlisting.fandom.com/wiki/Superpower_Wiki)
|
||||
* superpower (Superpower Data)
|
||||
- [susi1959](https://en.picmix.com/profile/susi1959)
|
||||
* fire ([Image](https://en.picmix.com/stamp/FIRE-FRAME-ORANGE-cadre-feu-orange-360274))
|
||||
* fire-frame ([Image](https://en.picmix.com/stamp/FIRE-FRAME-ORANGE-cadre-feu-orange-360274))
|
||||
- [Tatsumaki](https://tatsumaki.xyz/)
|
||||
* beautiful (Image, Concept)
|
||||
* fishy (Concept)
|
||||
|
||||
|
Before Width: | Height: | Size: 517 KiB After Width: | Height: | Size: 517 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 142 KiB |
|
After Width: | Height: | Size: 138 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 111 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 111 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 114 KiB |
@@ -0,0 +1,72 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const GIFEncoder = require('gifencoder');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { streamToArray } = require('../../util/Util');
|
||||
const { drawImageWithTint } = require('../../util/Canvas');
|
||||
const frameCount = 31;
|
||||
|
||||
module.exports = class FireCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'fire',
|
||||
aliases: ['hell', 'burn'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'fire',
|
||||
description: 'Burns a user\'s avatar.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'LowGif',
|
||||
url: 'http://www.lowgif.com/',
|
||||
reason: 'Images',
|
||||
reasonURL: 'http://www.lowgif.com/43360ebce9150f23.html'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
},
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
|
||||
try {
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const encoder = new GIFEncoder(avatar.width, avatar.height);
|
||||
const canvas = createCanvas(avatar.width, avatar.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
const stream = encoder.createReadStream();
|
||||
encoder.start();
|
||||
encoder.setRepeat(0);
|
||||
encoder.setDelay(4);
|
||||
encoder.setQuality(200);
|
||||
const ratio = avatar.width / avatar.height;
|
||||
const height = Math.round(avatar.width / ratio);
|
||||
for (let i = 0; i < frameCount; i += 2) {
|
||||
const frameID = `frame-${i.toString.padStart(2, '0')}.gif`;
|
||||
const frame = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'fire', frameID));
|
||||
drawImageWithTint(ctx, avatar, '#fc671e', 0, 0);
|
||||
ctx.drawImage(frame, 0, avatar.height - height, avatar.width, height);
|
||||
encoder.addFrame(ctx);
|
||||
encoder.addFrame(ctx);
|
||||
}
|
||||
encoder.finish();
|
||||
const buffer = await streamToArray(stream);
|
||||
return msg.say({ files: [{ attachment: Buffer.concat(buffer), name: 'fire.gif' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -4,13 +4,13 @@ const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { drawImageWithTint } = require('../../util/Canvas');
|
||||
|
||||
module.exports = class FireCommand extends Command {
|
||||
module.exports = class FireFrameCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'fire',
|
||||
aliases: ['hell'],
|
||||
name: 'fire-frame',
|
||||
aliases: ['hell-frame', 'burn-frame'],
|
||||
group: 'edit-image',
|
||||
memberName: 'fire',
|
||||
memberName: 'fire-frame',
|
||||
description: 'Draws a fiery border over an image or a user\'s avatar.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
@@ -38,7 +38,7 @@ module.exports = class FireCommand extends Command {
|
||||
|
||||
async run(msg, { image }) {
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'fire.png'));
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'fire-frame.png'));
|
||||
const { body } = await request.get(image);
|
||||
const data = await loadImage(body);
|
||||
const canvas = createCanvas(data.width, data.height);
|
||||
@@ -47,7 +47,7 @@ module.exports = class FireCommand extends Command {
|
||||
ctx.drawImage(base, 0, 0, data.width, data.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: 'fire.png' }] });
|
||||
return msg.say({ files: [{ attachment, name: 'fire-frame.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "115.4.0",
|
||||
"version": "116.0.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||