A modern Discord weather bot built with Node.js, OpenAI, and OpenWeatherMap, based on the @purinton/discord foundation. Provides real-time weather, multi-language support, and automated weather reports for any location.
- Features
- Getting Started
- Configuration
- Running as a Service (systemd)
- Docker
- Customization
- Testing
- Support
- License
- Discord.js-based app with ESM support
- Command and event handler architecture
- Multi-language/localized responses
- Real-time weather via OpenWeatherMap
- Automated weather reports with cron scheduling
- AI-powered location and report generation via OpenAI
- Environment variable support via dotenv
- Logging and signal handling via
@purinton/common
- Ready for deployment with systemd or Docker
- Jest for testing
-
Clone this project:
git clone https://github.com/purinton/wx.git cd wx npm install
-
Set up your environment:
- Copy
.env.example
to.env
and fill in your Discord app token, OpenAI key, and other secrets. - Edit
package.json
(name, description, author, etc.) - Update this
README.md
as needed.
- Copy
-
Start the app locally:
npm start # or node wx.mjs
- All configuration is handled via environment variables in the
.env
file. - See
.env.example
for required and optional variables. - For scheduled weather reports, edit
cron.json
(seecron.json.example
).
-
Copy
wx.service
to/usr/lib/systemd/system/wx.service
. -
Edit the paths and user/group as needed.
-
Reload systemd and start the service:
sudo systemctl daemon-reload sudo systemctl enable wx sudo systemctl start wx sudo systemctl status wx
-
Build the Docker image:
docker build -t wx .
-
Run the container:
docker run --env-file .env wx
- Add new commands in the
commands/
directory. - Each command has a
.json
definition (for Discord registration/localization) and a.mjs
handler (for logic).
- Add or modify event handlers in the
events/
directory. - Each Discord event (e.g.,
ready
,messageCreate
,interactionCreate
) has its own handler file.
- Add or update language files in the
locales/
directory. - Localize command names, descriptions, and app responses.
-
Run tests with:
npm test
-
Add your tests in the
tests/
folder or alongside your code.
For help, questions, or to chat with the author and community, visit: