const { Client, CommandInteraction } = require("discord.js"); ​ const { MessageEmbed } = require("discord.js"); ​ const { QuickDB } = require ('quick.db'); const db = new QuickDB({ filePath: './allowedrank.sqlite' }); ​ const noblox = require('noblox.js'); ​ module.exports = { name: "promote", description: "promote a user", userPermissions: "", options: [{ name: "username", type: 3, required: true, description: "Roblox Username" },{ name: "groupid", type: 4, required: true, description: "Roblox group id" }], ​ /** * * @param {Client} client * @param {CommandInteraction} interaction * @param {String[]} args */ run: async (client, interaction, args) => { //const allowedRank = db.get("allowedRank", role.id) ​ // if (!allowedRank) { //interaction.reply({content: "You don't have access to use this command", ephemeral: true}) // } const robloxUsername = interaction.options.getString('username'); const robloxGroupId = interaction.options.getInteger('groupid'); // Does this need to be a prompt, or can it just be a fixed environment variable? ​ try { // Convert the username to a Roblox ID const robloxUserId = await noblox.getIdFromUsername(robloxUsername) ​ // Promote the user to the next-ranked role const { _, newRole } = await noblox.promote(robloxGroupId, robloxUserId) ​ // Send a comfirmation message const Embed = new MessageEmbed() .setTitle("Promotion Command") .setDescription(`${robloxUsername} [${robloxUserId}] has been promoted to rank ${newRole.name}.`) .setColor("GREEN"); await interaction.reply({embeds: [Embed], ephemeral: false}) } catch (err) { console.error(err) const Embed2 = new MessageEmbed() .setTitle("Promotion Command") .setDescription("Unable to process the request at this time.") .setColor("RED"); await interaction.reply({embeds: [Embed2], ephemeral: true}) } } };