#Help with Registering Slash Commands
11 messages · Page 1 of 1 (latest)
Wrong script
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
module.exports = {
command: new SlashCommandBuilder()
.setName("stars")
.setDescription(`Manage a member's Stars`)
.setDMPermission(false)
.addSubcommand(subcommand =>{
subcommand
.setName('add')
.setDescription(`Add Stars to a member's balance`)
.addUserOption(user =>{
user
.setName("user")
.setDescription(`The user you are giving stars to`)
.setRequired(true)
})
.addStringOption(amount =>{
amount
.setName("amount")
.setDescription(`The amount of stars you are giving`)
.setRequired(true)
})
})
}
show me where you deploy the command
const { REST } = require('@discordjs/rest');
const { Routes, SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
const { token, clientId, guildId } = require('./JSON/config.json');
const rest = new REST({ version: '10' }).setToken(token);
const fs = require("fs");
rest.on("rateLimited", console.log).on("restDebug", console.log);
const commandFiles = fs.readdirSync("./slash-commands/");
const commands = []
for(const commandFile of commandFiles){
const cmdData = require(`./slash-commands/${commandFile}`);
commands.push(cmdData.command);
}
commands.map(cmd => cmd.toJSON());
rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands }
)
.catch(console.error)
like i said, this works for my other bots
u didnt return the user option inside addUserOption method
since u use a bracket u must return it
Okay