discord-slash-bot
discord-slash-bot copied to clipboard
DiscordAPIError: InvalidFormBody when starting bot
Getting this error:
DiscordAPIError: Invalid Form Body
options[0].name: Command name is invalid
Using Node.js v16.9.1, npm v7.21.1
Steps to reproduce:
-
git clone https://github.com/muratvastark/discord-slash-bot
-
cd ./discord-slash-bot/
-
npm install
- add
TOKEN
andBOT_ID
in.env.example
- rename
.env.example
to.env
-
npm start
Entire error:
.\node_modules\discord.js\src\rest\RequestHandler.js:154
throw new DiscordAPIError(request.path, data, request.method, res.status);
^
DiscordAPIError: Invalid Form Body
options[0].name: Command name is invalid
at RequestHandler.execute .\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (.\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
at async Client.<anonymous> (.\app.js:14:3) {
method: 'post',
path: '/applications/<BOT_ID>/commands',
code: 50035,
httpStatus: 400
}
package.json
{
"name": "discord-slash-bot",
"version": "1.0.0",
"description": "This bot is a simple Discord Slash Bot.",
"main": "app.js",
"scripts": {
"format": "prettier --write .",
"start": "node app",
"dev": "nodemon"
},
"keywords": [
"discord",
"discord.js",
"discord slash commands"
],
"author": "Muratva Stark",
"license": "MIT",
"dependencies": {
"discord.js": "^12.5.1",
"dotenv": "^8.2.0"
},
"devDependencies": {
"nodemon": "^2.0.6",
"prettier": "^2.2.1"
}
}