An open API service indexing awesome lists of open source software.

https://github.com/george-silviu/node-discord-bot

Multifunctional discord bot
https://github.com/george-silviu/node-discord-bot

3rd-party-api discord-js node

Last synced: about 2 months ago
JSON representation

Multifunctional discord bot

Awesome Lists containing this project

README

          

# Node Discord Bot

Node.js Discord bot that can:

- ✅ display the weather forecast;
- ✅ display the position of sun and moon;
- ✅ tell jokes;
- ✅ inspire you with quotes from different categories;

## General overview

![app-schema](/src/assets/app-schema.png)

In our Node app, the Discord Bot will connect to Discord API using `discord.js` library through WebSocket connection, and will listen for any commands prompted from the Discord UI. The Bot has defined a set of commands that will run each time a user uses a slash command.

## Bot tutorial in Discord Client

🔗[The video tutorial test from Discord client](https://github.com/george-silviu/node-discord-bot/raw/refs/heads/main/src/assets/bot-testing.mp4)

## Steps for setup

1. Be sure you have[Node.js](https://nodejs.org/en) installed.
2. Open a terminal and run `npm install`.
3. Create a new [Discord](https://discord.com/) account if you do not have one.
4. Create a Discord server to test the bot, then find the server/guild ID by turning the developer mode.
5. Navigate to [Discord Developers page](https://discord.com/developers/applications) and create a new app, then find the application/client ID.
6. Invite the bot to your server.
7. Sign up to a free [Weather API](https://www.weatherapi.com/) account and find your API key.
8. Sign up to a free [API Ninjas](https://api-ninjas.com/) account and find your API key.
9. Create a `.env` file at the root of the project and insert the data as below.

## Environment variables

Populate the following values in `.env`:

```
DISCORD_TOKEN=
CLIENT_ID=
GUILD_ID=
WHEATHER_API_KEY=
API_NINJAS_KEY=
```

## Running the project

- Production script: `npm start`
- Development: `npm run dev`

## 📌 Resources

- [Discord.js](https://discord.js.org/)
- [Discord.js Guide](https://discordjs.guide/)
- [Discord Developer Portal](https://discord.com/developers/applications)
- [Weather API](https://www.weatherapi.com/)
- [API Ninjas](https://api-ninjas.com/)

## 🤔Fun stuff to do next:

- Integrate the bot with AI
- Integrate bot with a music streaming service