Error while adding option to command.
Whenever I try to add an option to my command, it breaks. Can anyone tell me why?
My commands:
My SlashCommandBuilder:
My command register system:
My commands:
var modCommandsList = [
['ban', 'Bans the specified user.', 'user', true],
['kick', 'Kicks the specified user.', 'user', true],
['report', 'Reports the specified user to moderators.', 'user', true],
]var modCommandsList = [
['ban', 'Bans the specified user.', 'user', true],
['kick', 'Kicks the specified user.', 'user', true],
['report', 'Reports the specified user to moderators.', 'user', true],
]My SlashCommandBuilder:
for (const i in modCommandsList) {
modCommands.push(
new SlashCommandBuilder()
.setName(modCommandsList[i][0])
.setDescription(modCommandsList[i][1])
.addUserOption((option) => {
option.setName(modCommandsList[i][2]).setDescription(modCommandsList[i][2]).setRequired(modCommandsList[i][3])
})
)
}for (const i in modCommandsList) {
modCommands.push(
new SlashCommandBuilder()
.setName(modCommandsList[i][0])
.setDescription(modCommandsList[i][1])
.addUserOption((option) => {
option.setName(modCommandsList[i][2]).setDescription(modCommandsList[i][2]).setRequired(modCommandsList[i][3])
})
)
}My command register system:
try {
console.log('Started refreshing application (/) commands.')
rest.put(Routes.applicationCommands(CLIENT_ID), { body: modCommands })
console.log('Successfully reloaded application (/) commands.')
} catch (error) {
console.error(error)
}try {
console.log('Started refreshing application (/) commands.')
rest.put(Routes.applicationCommands(CLIENT_ID), { body: modCommands })
console.log('Successfully reloaded application (/) commands.')
} catch (error) {
console.error(error)
}