error undefined slash cmd

i've this error, how to repair this ?. all is good but not this
8 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Max
MaxOP2y ago
- app is just constructor for create new instance and add many functions - app.init(app); has this function and others... :
async initSlash(app) {
let client = app.client;
let arrayOfSlashCommands = [];
client.slash?.forEach(f => {
arrayOfSlashCommands.push(f);
})
console.log(arrayOfSlashCommands);
if(client.testingServerID) {
console.log(client.guilds.cache)
// client.guilds.cache
// .get(client.testingServerID)
// .commands.set(arrayOfSlashCommands);
} else {
client.application.commands.set(arrayOfSlashCommands);
}
}

/**
* All init in one function.
*/
init(app, db) {
app.client.on('messageCreate', async message => { this.handleCommand(app, message) });
this.handleEvent(app);
this.initSlash(app);
app.client.on("interactionCreate", async interactions => {
if (interactions.isCommand()) { this.handleSlash(app, interactions) } else { this.createInteraction(app, interactions) }
})
this.dbInit(db).then(app.client.log ? log : '');
}
async initSlash(app) {
let client = app.client;
let arrayOfSlashCommands = [];
client.slash?.forEach(f => {
arrayOfSlashCommands.push(f);
})
console.log(arrayOfSlashCommands);
if(client.testingServerID) {
console.log(client.guilds.cache)
// client.guilds.cache
// .get(client.testingServerID)
// .commands.set(arrayOfSlashCommands);
} else {
client.application.commands.set(arrayOfSlashCommands);
}
}

/**
* All init in one function.
*/
init(app, db) {
app.client.on('messageCreate', async message => { this.handleCommand(app, message) });
this.handleEvent(app);
this.initSlash(app);
app.client.on("interactionCreate", async interactions => {
if (interactions.isCommand()) { this.handleSlash(app, interactions) } else { this.createInteraction(app, interactions) }
})
this.dbInit(db).then(app.client.log ? log : '');
}
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Max
MaxOP2y ago
the problem remains the same, its cannot read "commands"
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs2y ago
Suggestion for @kuracho:guide Creating Your Bot: Registering slash commands read more
Max
MaxOP2y ago
5802catwtf u
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server