Add reactions to emojizip

This commit is contained in:
Dragon Fire
2021-03-28 21:45:37 -04:00
parent d04d8df328
commit 1701c431a1
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -1,6 +1,8 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const JSZip = require('jszip');
const { reactIfAble } = require('../../util/Util');
const { LOADING_EMOJI_ID, SUCCESS_EMOJI_ID } = process.env;
module.exports = class EmojiZipCommand extends Command {
constructor(client) {
@@ -21,6 +23,7 @@ module.exports = class EmojiZipCommand extends Command {
async run(msg) {
const emojis = msg.guild.emojis.cache;
if (!emojis.size) return msg.say('This server has no custom emoji.');
await reactIfAble(msg, this.client.user, LOADING_EMOJI_ID, '💬');
const zip = new JSZip();
await Promise.all(emojis.map(async emoji => {
const { body } = await request.get(emoji.url);
@@ -28,6 +31,7 @@ module.exports = class EmojiZipCommand extends Command {
zip.file(`${emoji.id}.${format}`, body);
}));
const zipped = await zip.generateAsync({ type: 'nodebuffer' });
await reactIfAble(msg, this.client.user, SUCCESS_EMOJI_ID, '✅');
return msg.say({ files: [{ attachment: zipped, name: 'emoji.zip' }] });
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "134.4.1",
"version": "134.5.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {