import { Command } from 'discord-akairo'; import { Message } from 'discord.js'; import { oneLine } from 'common-tags'; import { colour } from '../../Config'; export default class ListReaction extends Command { public constructor() { super('reactionlist', { aliases: ['reactionlist', 'reactionls'], category: 'reactions', description: { content: 'Lists all current reaction roles.', usage: '', examples: [ '' ] }, ratelimit: 3, userPermissions: ['MANAGE_ROLES'], channel: 'guild' }); } public async exec(msg: Message): Promise { const reactions = this.client.settings.cache.reactions.filter(r => r.guildID === msg.guild!.id && r.active); if (!reactions.size) return msg.reply('you have no live reaction roles!'); const embed = this.client.util.embed() .setColor(colour) .setTitle('Live Reaction Roles') .setDescription( reactions .map(r => { const emoji = r.emojiType === 'custom' ? this.client.emojis.cache.get(r.emoji) : r.emoji; return oneLine`[\`${r.id}\`] ${emoji} ${this.client.channels.cache.get(r.channelID) || '#deleted-channel'} ${msg.guild!.roles.cache.get(r.roleID) || '@deleted-role'} `; }) .join('\n') .substring(0, 2048), ); return msg.reply({ embed }); } }