https://github.com/rootz491/rootz491-bot
my bot for discod
https://github.com/rootz491/rootz491-bot
Last synced: about 1 month ago
JSON representation
my bot for discod
- Host: GitHub
- URL: https://github.com/rootz491/rootz491-bot
- Owner: rootz491
- Created: 2022-01-06T08:49:27.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-15T22:34:00.000Z (over 3 years ago)
- Last Synced: 2026-01-31T12:23:37.910Z (4 months ago)
- Language: JavaScript
- Size: 402 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# discord bot
start creating a discord bot
* create a client & login to discord with token
* register commands (read [deploy-commands.js](./deploy-commands.js) file)
* come back to `app.js` and add a listener for these commands.
```js
client.on('interactionCreate', async interaction => {
// send back reply or something.
});
```
Here `interaction` is like a request from discord by bot when user interacts with it (runs a command).
> more info on guild object [here](https://discord.js.org/#/docs/main/stable/class/Guild)
---
* when user interacts with bot or something, discord emits an event.
these events are handled by our application.
as there can be many events, we will handle them in seperate file.
it's similar to command handling.
* File [deploy-commands.js](./deploy-commands.js) register commands using it to the discord server.
* File [register-commands.js](./tools/register-commands.js) will add commands of `commands` folder to the bot (client) as a collection.
---
## useful
* list of all discord.js events [gist](https://gist.github.com/koad/316b265a91d933fd1b62dddfcc3ff584)
* mongodb to bot [tutorial](https://www.youtube.com/watch?v=a3Gz_7KEJkQ)