const { Command } = require('../../../../interfaces/'); //Apparently hit ratelimits pretty damn quick and doesn't expire often. class LookupCommand extends Command { constructor(client) { super(client, { name: 'lookup', module: 'utility', usage: "", showUsage: true, examples: [ "SvJgtEj", "discord.gg/SvJgtEj" ], restricted: true //For now // throttling: { // usages: 1, // duration: 30 // } }); this.client = client; } async execute(message, { params }) { let invite = null; try { invite = await this.client.fetchInvite(params); } catch(e) { return message.respond(message.format('C_LOOKUP_FAILEDMATCH'), { emoji: 'failure' }); } console.log(invite); const fields = []; if(invite.inviter) { fields.push({ name: "Inviter", value: `${invite.inviter.username}#${invite.inviter.discriminator} \`(${invite.inviter.id})\``, inline: true }); } if(invite.memberCount) { fields.push({ name: "Member Count", value: `${invite.memberCount} members`, inline: true }); } if(invite.channel) { fields.push({ name: "Default Channel", value: `#${invite.channel.name} \`(${invite.channel.id})\``, inline: true }); } if(invite?.guild?.features.length > 0) { fields.push({ name: "Features", value: invite.guild.features.map((f) => `\`${f}\``).join(', '), inline: true }); } const embed = { author: { name: `${invite.guild.name} (${invite.guild.id})`, icon_url: invite.guild.iconURL() //eslint-disable-line camelcase }, thumbnail: { url: invite.guild.splash ? invite.guild.splashURL() : invite.guild.iconURL() }, description: invite.guild.description || null, fields, footer: { text: ` https://discord.gg/${invite.code}` } }; return message.embed(embed); } } module.exports = LookupCommand;