#thread
1 messages · Page 1 of 1 (latest)
const fs = require('fs');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { clientId, guildId, token } = require('./config.json');
const commands = [];
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(./commands/${file});
commands.push(command.data.toJSON());
}
go to ur commands folder
and go to
newPlayer.js
send me the first 10 lines
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('newPlayer')
.setDescription('Add a new player to the bot.')
.addStringOption(option =>
option.setName('category')
.setDescription('The gif category')
.setRequired(true)
.addChoice('Funny', 'gif_funny')
ok wait
can u send the error again
module.exports = {
data: new SlashCommandBuilder()
.setName('newPlayer')
.setDescription('Add a new player to the bot.')
.addStringOption(option =>
option.setName('category')
.setDescription('The gif category')
.setRequired(true)
.addChoice('Funny', 'gif_funny')```
ah ok
this is the error
I was trying to copy and slightly modify code form the djs guide (https://discordjs.guide/interactions/registering-slash-commands.html#guild-commands) but it doesnt seem to have worked
change the command name to newplayer
instead of newPlayer
no problem