Skip to content

Commit 4cde850

Browse files
author
nonsensetwice
committed
removed or updated commented-out code, removed unused files, updated README
1 parent 19d89d3 commit 4cde850

12 files changed

+67
-367
lines changed

.env.template

-5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,5 @@ MONGODB_PASS=
1414
MONGODB_CLUSTER=
1515
DB_NAME=
1616

17-
# Pino-Loki
18-
LOKI_HOST=
19-
LOKI_USERNAME=
20-
LOKI_PASSWORD=
21-
2217
# Sentry
2318
SENTRY_IO_DSN=

README.md

+40
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,42 @@
11
# spades
22
discord.js bot template
3+
4+
This is a basic discord bot template written in JS, running in Node v18+. The bot is built with minimal dependencies:
5+
- [discord.js](https://discord.js.org) library to interact with the [Discord API](https://discord.com/developers/docs/intro),
6+
- [sapphire](https://www.sapphirejs.dev), a command framework as an extension of discord.js,
7+
- [esLint](https://eslint.org), a code linter for keeping code consistent across all files,
8+
- [dotenv](https://www.dotenv.org/docs) for configuring and utilizing `.env` files,
9+
- a [mongodb](https://mongodb.github.io/node-mongodb-native/) node driver, for connecting and interaction with an instance of MongoDB Atlas,
10+
- [pino](https://getpino.io/), a lightweight logger, and
11+
- [sentry](https://sentry.io) for error tracing.
12+
13+
the idea is to get a bot up a running with logging, error tracing, database connectivity, and a solid command structure. The utilities are barebones--build them up or swap them out at your leisure.
14+
15+
## getting started
16+
tap the "Use this template" and create a new repository. copy the `.env.template`, rename it to `.env`, and fill out the fields with your credentials. you'll need:
17+
- a bot token, application id, and public key from Discord. you can find those in the [Discord Developer Portal](https://discord.com/developers) when you create an app,
18+
- a URI connection string from [MongoDB Atlas](https://mongodb.com), and
19+
- a client key--known as a "DSN"--from [Sentry](https://sentry.io).
20+
21+
you may also want to install Docker and Docker Compose, if you want to run the bot in a container.
22+
23+
once all the fields are filled out, you can:
24+
```
25+
npm install
26+
```
27+
then
28+
```
29+
npm run start
30+
```
31+
to run the bot locally through Node in your dev environment, or:
32+
```
33+
docker compose up
34+
```
35+
to run the bot in a Docker container.
36+
37+
if all works well, you should see your bot active in your Discord server once you invite it. To test it, run the `/ping` command.
38+
39+
## ongoing development
40+
active development will take place as libraries and frameworks are updated, or to improve error tracing, logging, and app monitoring. if you're interested in contributing to the source code or find a bug to report, reach out to me on [twitter](https://twitter.com/nonsensecodes); issue guides will be forthcoming.
41+
42+
and that's it! happy building!

docker-compose.debug.yml

+17
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@ services:
88
dockerfile: ./Dockerfile
99
environment:
1010
NODE_ENV: development
11+
APP_NAME: ${spades}
12+
13+
# Discord application
14+
DISCORD_BOT_TOKEN: ${DISCORD_BOT_TOKEN}
15+
DISCORD_BOT_PUBLIC_KEY: ${DISCORD_BOT_PUBLIC_KEY}
16+
DISCORD_BOT_APPLICATION_ID: ${DISCORD_BOT_APPLICATION_ID}
17+
DISCORD_BOT_ACTIVITY: ${DISCORD_BOT_ACTIVITY}
18+
19+
# MongoDB
20+
MONGODB_PREFIX: ${MONGODB_PREFIX}
21+
MONGODB_USERNAME: ${MONGODB_USERNAME}
22+
MONGODB_PASS: ${MONGODB_PASS}
23+
MONGODB_CLUSTER: ${MONGODB_CLUSTER}
24+
DB_NAME: ${DB_NAME}
25+
26+
# Sentry
27+
SENTRY_IO_DSN: ${SENTRY_IO_DSN}
1128
ports:
1229
- 9229:9229
1330
command: ["node", "--inspect=0.0.0.0:9229", "src/app/app.js"]

docker-compose.yml

-5
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,5 @@ services:
2323
MONGODB_CLUSTER: ${MONGODB_CLUSTER}
2424
DB_NAME: ${DB_NAME}
2525

26-
# Pino-Loki
27-
LOKI_HOST: ${LOKI_HOST}
28-
LOKI_USERNAME: ${LOKI_USERNAME}
29-
LOKI_PASSWORD: ${LOKI_PASSWORD}
30-
3126
# Sentry
3227
SENTRY_IO_DSN: ${SENTRY_IO_DSN}

0 commit comments

Comments
 (0)