TravBot-v3/src/commands/utilities/lsemotes.ts

33 lines
1.1 KiB
TypeScript
Raw Normal View History

2020-12-15 01:44:28 +00:00
import {MessageEmbed} from "discord.js";
import Command from "../../core/command";
import {CommonLibrary} from "../../core/lib";
export default new Command({
2020-12-15 01:44:28 +00:00
description: "Lists all emotes the bot has in it's registry,",
endpoint: true,
async run($: CommonLibrary): Promise<any> {
const nsfw: string | string[] = [];
2020-12-15 07:56:09 +00:00
const pages = $.client.emojis.cache.filter((x) => !nsfw.includes(x.guild.id), this).array();
2020-12-15 01:44:28 +00:00
const pagesSplit = $(pages).split(20);
$.log(pagesSplit);
2020-12-15 07:56:09 +00:00
var embed = new MessageEmbed().setTitle("**Emoji list!**").setColor("AQUA");
2020-12-15 01:44:28 +00:00
let desc = "";
for (const emote of pagesSplit[0]) {
desc += `${emote} | ${emote.name}\n`;
}
2020-12-15 01:44:28 +00:00
embed.setDescription(desc);
const msg = await $.channel.send({embed});
$.paginate(msg, $.author.id, pages.length, (page) => {
let desc = "";
for (const emote of pagesSplit[page]) {
desc += `${emote} | ${emote.name}\n`;
}
embed.setDescription(desc);
msg.edit(embed);
});
}
});