mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Emoji Zip Command
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
const JSZip = require('jszip');
|
||||
|
||||
module.exports = class EmojiZipCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'emoji-zip',
|
||||
aliases: ['emojis-zip', 'emotes-zip', 'e-zip'],
|
||||
group: 'info',
|
||||
memberName: 'emoji-zip',
|
||||
description: 'Responds with a ZIP file of the server\'s custom emoji.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 60
|
||||
},
|
||||
guildOnly: true
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
const emojis = msg.guild.emojis.cache;
|
||||
if (!emojis.size) return msg.say('This server has no custom emoji.');
|
||||
const zip = new JSZip();
|
||||
await Promise.all(emojis.map(async emoji => {
|
||||
const { body } = await request.get(emoji.url);
|
||||
const format = emoji.animated ? 'gif' : 'png';
|
||||
zip.file(`${emoji.id}.${format}`, body);
|
||||
}));
|
||||
const zipped = await zip.generateAsync({ type: 'nodebuffer' });
|
||||
return msg.say({ files: [{ attachment: zipped, name: 'emoji.zip' }] });
|
||||
}
|
||||
};
|
||||
@@ -60,6 +60,7 @@
|
||||
"ioredis": "^4.24.5",
|
||||
"js-beautify": "^1.13.5",
|
||||
"js-chess-engine": "^0.11.1",
|
||||
"jszip": "^3.6.0",
|
||||
"kuroshiro": "^1.1.2",
|
||||
"kuroshiro-analyzer-kuromoji": "^1.1.0",
|
||||
"mathjs": "^9.3.0",
|
||||
|
||||
Reference in New Issue
Block a user