import { Message } from 'eris'; import { Command, RichEmbed } from '../class'; import { dataConversion } from '../functions'; import { Client } from '..'; export default class SetLimit extends Command { constructor(client: Client) { super(client); this.name = 'limits'; this.description = 'Views resource limits for each tier.'; this.usage = `${this.client.config.prefix}limits`; this.subcmds = []; this.enabled = true; } public async run(message: Message) { try { const tiers = await this.client.db.Tier.find(); const embed = new RichEmbed(); embed.setTitle('Resource Limit Information'); embed.setFooter(this.client.user.username, this.client.user.avatarURL); embed.setTimestamp(); for (const tier of tiers.sort((a, b) => a.id - b.id)) { embed.addField(`Tier ${tier.id}`, `**RAM:** ${dataConversion(tier.resourceLimits?.ram * 1024 * 1024) ?? '0 B'}\n**Storage:** ${dataConversion(tier.resourceLimits?.storage * 1024 * 1024) ?? '0 B'}`); } return message.channel.createMessage({ embed }); } catch (error) { return this.client.util.handleError(error, message, this); } } }