|
| 1 | +<h1 align="center">Spades</h1> |
| 2 | + |
| 3 | +<p align="center"> |
| 4 | + <br> |
| 5 | + <img |
| 6 | + src="./assets/lvnacy_emblem_plain.png" |
| 7 | + alt="the lvnacy emblem, a gray circle with a large black 'V' superimposed." |
| 8 | + width="120px" |
| 9 | + /> |
| 10 | + <br> |
| 11 | + <br> |
| 12 | + <i> |
| 13 | + Another Discord.js Bot Template |
| 14 | + </i> |
| 15 | + <br> |
| 16 | +</p> |
| 17 | + |
| 18 | +<p align="center"> |
| 19 | + • |
| 20 | + <a href="https://bsky.app/profile/lvnacy.xyz/">L V N A C Y Bluesky</a> |
| 21 | + • |
| 22 | + <a href="https://discord.gg/nh7mqGEfbw">L V N A C Y Discord</a> |
| 23 | + • |
| 24 | + <br> |
| 25 | +</p> |
| 26 | +<hr> |
| 27 | +<br> |
| 28 | + |
| 29 | +This is a basic discord bot template written in JS, running in Node v22+. The |
| 30 | +bot is built with minimal dependencies: |
| 31 | +- [discord.js](https://discord.js.org) library to interact with the |
| 32 | +[Discord API](https://discord.com/developers/docs/intro), |
| 33 | +- [sapphire](https://www.sapphirejs.dev), a command framework as an extension |
| 34 | +of discord.js, |
| 35 | +- [esLint](https://eslint.org), a code linter for keeping code consistent |
| 36 | +across all files, |
| 37 | +- [dotenv](https://www.dotenv.org/docs) for configuring and utilizing `.env` |
| 38 | +files, |
| 39 | +- a [mongodb](https://mongodb.github.io/node-mongodb-native/) node driver, for |
| 40 | +connecting and interaction with an instance of MongoDB Atlas, |
| 41 | +- [pino](https://getpino.io/), a lightweight logger, and |
| 42 | +- [pnpm](pnpm.io) as the package manager. |
| 43 | + |
| 44 | +The idea is to get a bot up a running with logging, database connectivity, and |
| 45 | +a solid command structure. The utilities are barebones--build them up or swap |
| 46 | +them out at your leisure. |
| 47 | + |
| 48 | +## Getting Started |
| 49 | +Tap or click the "Use this template" and create a new repository. copy the |
| 50 | +`.env.template`, rename it to `.env`, and fill out the fields with your |
| 51 | +credentials. you'll need: |
| 52 | +- a bot token, application id, and public key from Discord. You can find those |
| 53 | +in the [Discord Developer Portal](https://discord.com/developers) when you |
| 54 | +create an app, |
| 55 | +- a URI connection string from [MongoDB Atlas](https://mongodb.com), and |
| 56 | +- a client key--known as a "DSN"--from [Sentry](https://sentry.io). |
| 57 | + |
| 58 | +You may also want to install Docker and Docker Compose, if you want to run the |
| 59 | +bot in a container. |
| 60 | + |
| 61 | +Once all the fields are filled out, you can: |
| 62 | +```bash |
| 63 | +pnpm install |
| 64 | +``` |
| 65 | +then |
| 66 | +```bash |
| 67 | +pnpm start |
| 68 | +``` |
| 69 | +to run the bot locally through Node in your dev environment, or: |
| 70 | +```bash |
| 71 | +docker compose up |
| 72 | +``` |
| 73 | +to run the bot in a Docker container. |
| 74 | + |
| 75 | +If all works well, you should see your bot active in your Discord server once |
| 76 | +you invite it. To test it, run the `/ping` command. |
| 77 | + |
| 78 | +## Ongoing Development |
| 79 | +active development will take place as libraries and frameworks are updated, or |
| 80 | +to improve error tracing, logging, and app monitoring. if you're interested in |
| 81 | +contributing to the source code or find a bug to report, reach out to me on |
| 82 | +[Bluesky](https://bsky.app/profile/lvnacy.xyz); issue guides will be |
| 83 | +forthcoming. |
| 84 | + |
| 85 | +And that's it! happy building! |
0 commit comments