sunbot is a serverless Discord bot that may or may not shine brighter than the sun (more than likely the latter).
Yes! sunbot operates on the serverless computing model. This means that rather than continuously run, sunbot sits behind a webserver and only runs when requests come in. This is possible due to Discord's support for interactions via webhooks.
Currently, sunbot will work out of the box as a AWS Lambda function, provided that you change the handler setting to src/index.handler.
cp .env.sample .env
chmod 600 .envEdit .env as needed.
npm run deployThe deployment script assumes that you're using AWS Lambda to host sunbot and that you have AWS CLI installed and configured.
Install the pre-commit git hook to automatically run the unit tests before each commit:
npm run precommit- src/
- bot/ - The core code of the bot lives here.
- commands/ - Each Discord command managed by sunbot is defined in a file in this directory.
- lib/ - General library code should go here.
- index.js - This is the entry point of the bot's request handler.
- run_register_commands.js - This script registers the bot's commands to Discord. It exists outside of the request handler because it only needs to be run when a command is added or updated. The
npm run deployscript runs this script automatically.
Most of the core code in this bot is based on code from Build a Discord Bot With AWS Lambda + API Gateway by jakjus.