const pool = global.pool const fpbx = global.fpbx const client = global.client const log = global.log module.exports = {}; module.exports.execute = async (interaction) => { const [lookup] = await pool.query('SELECT * FROM discord_users WHERE discordId = ?', [interaction.user.id]); if (!lookup) { await interaction.reply({ content: `We're sorry, It doesn't look like you have an extension!`, ephemeral: true }); return; } const extInfo = await fpbx.getExtension(lookup.extension); await interaction.reply({ ephemeral: true, embeds: [ { title: "Your Extension Info", description: `**PBX Address:** \`${process.env.PBX_HOSTNAME}\`\n**Extension/Username:** \`${extInfo.fetchExtension.user.extension}\`\n**Name:** \`${extInfo.fetchExtension.user.name}\`\n**Password:** ||\`${extInfo.fetchExtension.user.extPassword}\`||`, color: 0x00ff00 } ] }); const EXTENSION_ROLE_ID = process.env.EXTENSION_ROLE_ID; if (EXTENSION_ROLE_ID) { const member = await interaction.guild.members.fetch(interaction.user.id); if (!member.roles.cache.has(EXTENSION_ROLE_ID)) { await member.roles.add(EXTENSION_ROLE_ID); } } }