feat: Add dashboard support and enhance Discord webhook functionality
- Updated docker-compose.yml to expose dashboard on port 8080. - Enhanced main.py with timezone database caching and improved state management. - Introduced a minimal dashboard using Flask to display webhook status and notifications. - Added templates.json for customizable embed messages in Discord notifications. - Created templates.py for loading and saving notification templates. - Implemented tests for dashboard rendering and main functionality. - Added requirements for Flask and tzdata to support new features. - Included test cases for timezone handling and template management.
This commit is contained in:
@@ -11,16 +11,21 @@ This Python application sends notifications to a Discord channel via webhook eve
|
||||
```
|
||||
|
||||
2. Set up your Discord webhook:
|
||||
|
||||
- Go to your Discord server settings > Integrations > Webhooks
|
||||
- Create a new webhook and copy the URL
|
||||
|
||||
3. Update the `.env` file with your webhook URL:
|
||||
3. Update the `.env` file with your webhook URL, bot token, channel ID, and guild ID:
|
||||
|
||||
```text
|
||||
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/your_webhook_id/your_webhook_token
|
||||
DISCORD_BOT_TOKEN=your_bot_token
|
||||
DISCORD_CHANNEL_ID=your_channel_id
|
||||
DISCORD_GUILD_ID=your_guild_id
|
||||
```
|
||||
|
||||
- To get a bot token, create a Discord bot in the [Discord Developer Portal](https://discord.com/developers/applications) and invite it to your server with the `Manage Messages` permission.
|
||||
- The channel ID can be found by enabling Developer Mode in Discord and right-clicking the channel name.
|
||||
|
||||
## Running the App
|
||||
|
||||
Run the application:
|
||||
@@ -31,6 +36,19 @@ python main.py
|
||||
|
||||
The app will run continuously and send notifications at the scheduled times.
|
||||
|
||||
### Dashboard
|
||||
|
||||
By default, a minimal dashboard is available at `http://localhost:8080/`.
|
||||
|
||||
You can disable it by setting `DASHBOARD_ENABLED=0`.
|
||||
|
||||
### Admin
|
||||
|
||||
You can edit the embed message templates at `http://localhost:8080/admin`.
|
||||
|
||||
- Templates are saved to `templates.json` by default.
|
||||
- Override the location with `TEMPLATES_PATH=/path/to/templates.json`.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3.6+
|
||||
|
||||
Reference in New Issue
Block a user