https://github.com/thesobersobber/discord-serverless-bot
serverless discord bot!
https://github.com/thesobersobber/discord-serverless-bot
bot discord-bot discord-js serverless
Last synced: 2 months ago
JSON representation
serverless discord bot!
- Host: GitHub
- URL: https://github.com/thesobersobber/discord-serverless-bot
- Owner: theSoberSobber
- License: mit
- Created: 2023-03-28T21:37:31.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-18T16:38:36.000Z (about 2 years ago)
- Last Synced: 2025-08-09T06:14:41.925Z (10 months ago)
- Topics: bot, discord-bot, discord-js, serverless
- Language: JavaScript
- Homepage:
- Size: 34.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Getting Started app for Discord
This project contains a basic discord bot that runs serverlessly and hence saves up on computing costs.
It doesn't need to be listening always and is triggered with the help of a webhook from the application and is verified using the Public key and the discord signature hash.
[
](https://glitch.com/edit/#!/import/github/theSoberSobber/discord-serverless-bot)
## Project structure
Below is a basic overview of the project structure:
```
├── abstractions -> short classes to make app making easier!
│ ├── app.js -> final code
│ ├── button.js
│ ├── command.js
│ ├── modal.js
│ ├── selectMenu.js
├── .env.sample -> sample .env file for people wanting to reproduce
├── app.js -> main entrypoint for app
├── commands.js -> slash command payloads + helpers
├── game.js -> logic specific to RPS
├── utils.js -> utility functions and enums
├── package.json
└── .gitignore
```
## Running app locally
Before you start, you'll need to install [NodeJS](https://nodejs.org/en/download/) and [create a Discord app and Bot](https://discord.com/developers/applications) with the proper permissions:
- `applications.commands`
- `bot` (with Send Messages enabled)
### Setup project
First clone the project:
```
git clone https://github.com/theSoberSobber/discord-serverless-bot.git
```
Then navigate to its directory and install dependencies:
```
cd discord-serverless-bot
npm install
```
### Get app credentials
Fetch the credentials from your app's settings and add them to a `.env` file (see `.env.sample` for an example). You'll need your app ID (`APP_ID`), bot token (`DISCORD_TOKEN`), and public key (`PUBLIC_KEY`).
### Install slash commands
The commands for the example app are set up in `commands.js`. All of the commands in the `ALL_COMMANDS` array at the bottom of `commands.js` will be installed when you run the `register` command configured in `package.json`:
```
npm run register
```
### Run the app
After your credentials are added, go ahead and run the app:
```
node app.js
```
## Cron Job Deployment
- Deployed on pipedream to run every 1 hour
- [Deployment](https://pipedream.com/@mesosan/serverless-dc-bot-p_brCyAGa)