Closed pwaillette closed 2 years ago
I have take only the example code. Is it correct ?
I have take only the example code. Is it correct ?
oh , i think you forgot something here user.applications.fetch() returns Promise\<Collection> therefore
const command = application.cache.first();
you need to change it to
const command = application.first();
Hello, I don't understand how to send slash commands ? I have an error with the example code :
const command = application.cache.first(); ^ TypeError: Cannot read properties of undefined (reading 'first') at Client.<anonymous> (/Users/aiko/Desktop/Developpement/Projets/JavaScript/Test/index.js:15:39)
My code are :
client.on("message", async (message) => { if (message.content === "aaa") { const botID = "mudae_id"; const user = await client.users.fetch(botID); const application = await user.applications.fetch(); console.log(application); const command = application.cache.first(); // Message: Discord.Message, using Message contructor create /* guildID: Guild.id || null, channelID: Channel.id, messageID: Message.id, */ await command.sendSlashCommand(message, ["profil"]); // Eg: Slash /add role:123456789 user:987654321 // value: ['123456789', '987654321'] // Channel.sendSlashCommand(botID, commandName, options): Comming soon ! } });
Can you help me, or explain to me how slash commands send work ?
I updated the new slash command usage
Hello, I don't understand how to send slash commands ? I have an error with the example code :
My code are :
Can you help me, or explain to me how slash commands send work ?