Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

DiscordAPIError: InvalidFormBody when starting bot #3

Open
nethe550 opened this issue Nov 1, 2021 · 0 comments
Open

DiscordAPIError: InvalidFormBody when starting bot #3

nethe550 opened this issue Nov 1, 2021 · 0 comments

Comments

@nethe550
Copy link

nethe550 commented Nov 1, 2021

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 and BOT_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"
	}
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant