Made with ❤ for my dear friend 💗Afreen💗
⚡️ \Command Handing ⚡️ \Event Handling ⚡️ \send, receive, and respond to buttons
How I created :
- Created a new dicord application, and then a discord Bot. Added into my server where I have manage authorization.
- npm commands:
npm init - to start a node project then initialise all details about the project, then go to vs code to open the folder.
npm install discord.js - Its a node.js module that allows us to interact with the discord API easily.
-
Create an application - I then set name for my bot , description, avatar.
-
Selected Bot from left navigation and "Add Bot" to set name and icon.
-
Add bot to the server with the url:
https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot
(copy paste the client Id in that place) -
register a slash command against the discord Api (Slash Commands are kotta way to build and interact with bots on Discord. With Slash Commands, / type cheste u canchoose the command
npm commands for slash:
npm install @discordjs/builders @discordjs/rest discord-api-types
// To solve the Missed access error(I faced that problem thats why), got to discord bot, go to OAuth2 >> In-app-Authourisation >> applications.commands check the box.
6. Run the bot!
"node . or node index.js " to run the file(node . can be used only when main:index.js otherwise set it)
Satwi's Bot/ ├── node_modules ├── config.json ├── deploy-commands.js ├── Commands -which is where you'll store all of your commands. ├── Events -which is where you'll store all of your events, and then retrieve dynamically from index.js ├── index.js ├── package-lock.json └── package.json