const { Client , Message, MessageEmbed, CommandInteraction, MessageActionRow, MessageButton } = require('discord.js')
const noblox = require('noblox.js')
const { Group_ID} = require('../config.json')
const { SlashCommandBuilder, EmbedBuilder } = require('@discordjs/builders')
module.exports = {
name: 'Promote',
description: 'Promotes a member in the group',
data : new SlashCommandBuilder()
.setName('promote')
.setDescription('Promotes a player')
.addStringOption(option =>
option.setName('username')
.setDescription('User to promote').setRequired(true)),
/**
*
* @param {Client} bot
* @param {Message} message
* @param {*} args
*/
async execute(bot , message, args) {
message.reply({ embeds: [embed] })
},
/**
*
* @param {Client} bot
* @param {CommandInteraction} interaction
*/
async slashexecute(bot , interaction) {
return console.log(interaction.commandId)
const username = interaction.options.getString('username')
await interaction.deferReply({ ephemeral: true})
try {
const id = await noblox.getIdFromUsername(username)
noblox.promote(Group_ID, id)
interaction.editReply({content : `Successfully Promoted **${username}**`})
} catch (error) {
interaction.editReply({content:error.message })
}
},
}
const { Client , Message, MessageEmbed, CommandInteraction, MessageActionRow, MessageButton } = require('discord.js')
const noblox = require('noblox.js')
const { Group_ID} = require('../config.json')
const { SlashCommandBuilder, EmbedBuilder } = require('@discordjs/builders')
module.exports = {
name: 'Promote',
description: 'Promotes a member in the group',
data : new SlashCommandBuilder()
.setName('promote')
.setDescription('Promotes a player')
.addStringOption(option =>
option.setName('username')
.setDescription('User to promote').setRequired(true)),
/**
*
* @param {Client} bot
* @param {Message} message
* @param {*} args
*/
async execute(bot , message, args) {
message.reply({ embeds: [embed] })
},
/**
*
* @param {Client} bot
* @param {CommandInteraction} interaction
*/
async slashexecute(bot , interaction) {
return console.log(interaction.commandId)
const username = interaction.options.getString('username')
await interaction.deferReply({ ephemeral: true})
try {
const id = await noblox.getIdFromUsername(username)
noblox.promote(Group_ID, id)
interaction.editReply({content : `Successfully Promoted **${username}**`})
} catch (error) {
interaction.editReply({content:error.message })
}
},
}