Failure to push a slash command
const getMp3 = () => {
const allTracks = fs.readdirSync(path.join(path.resolve(), 'audio')).filter(file => file.endsWith('.mp3'));
let trackData = [];
for (const track of allTracks) {
trackData.push({
name: track.substring(0, track.length - 4),
value: track
});
}
return trackData;
}const getMp3 = () => {
const allTracks = fs.readdirSync(path.join(path.resolve(), 'audio')).filter(file => file.endsWith('.mp3'));
let trackData = [];
for (const track of allTracks) {
trackData.push({
name: track.substring(0, track.length - 4),
value: track
});
}
return trackData;
}I use these as choices to a slash command option
export const data = new SlashCommandBuilder()
.setName("play")
.setDescription("Plays music in a voice channel")
.addStringOption(option => {option
.setName("query")
.setDescription("The song to play")
.setRequired(true)
.addChoices(...(getMp3()));
});export const data = new SlashCommandBuilder()
.setName("play")
.setDescription("Plays music in a voice channel")
.addStringOption(option => {option
.setName("query")
.setDescription("The song to play")
.setRequired(true)
.addChoices(...(getMp3()));
});I get an error
Djs version 14.15.3