Reputation: 102
I've been trying to make a bot that uses slash commands and the code looks like this:
const Discord = require("discord.js")
const {token} = require("./config.json")
const client = new Discord.Client()
const guildId = "798268649613033532"
const getApp = (guildId) => {
const app = client.api.applications(client.user.id)
if (guildId) {
app.guilds(guildId)
}
return app
}
client.once("ready", async () => {
console.log("Ready!")
try {
const commands = getApp(guildId).commands.get()
console.log(commands)
} catch(err) {
console.error(err)
}
})
client.login(token)
but in the console it says: "Promise { } (node:1848) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access"
I know I have use slash commands permission/scope on
Upvotes: 0
Views: 7442
Reputation: 9041
Make sure that when you invite the bot, the scope is on. Also, use slash commands is a permission, not a scope. You need at least these 2 boxes checked when you copy the link.
Upvotes: 1