#Creating SlashCommands

1 messages · Page 1 of 1 (latest)

weary depot
#

I'll send info, let me get it

#

Code:

const { SlashCommandBuilder } = require('discord.js')
const SlashCommand = new SlashCommandBuilder()
//other unimportant, irrelevant code below```
Error:
```js
const SlashCommand = new SlashCommandBuilder()
                       ^

TypeError: SlashCommandBuilder is not a constructor```

I changed it from builders to discord.js, did I miss something here?
hard wing
#

Can you run npm ls discord.js please

weary depot
#

okay well apparently im still on v13?

hard wing
#

that'd be why

weary depot
#

it said it updated to v14

#

npm be tripping, thanks

#

client.api.applications(client.user.id).commands.post({ data: SlashCommand})

#
client.api.applications(client.user.id).commands.post({ data: SlashCommand})
           ^

TypeError: Cannot read properties of undefined (reading 'applications')```
hard wing
#

That changed to client.rest though we never supported doing it that way

slow chasmBOT
#

guide Creating Your Bot: Registering commands - Command deployment script
read more

hard wing
#

Note thats still v13 I think

#

But other than the imports, its the same

weary depot
#

I figured, I asked here because i knew the docs weren't v14 yet