zwitschi 1dcd80a8bb
Build and Deploy Docker Container / test (push) Failing after 26s
Build and Deploy Docker Container / build-and-deploy (push) Has been skipped
feat: add testing job to build-container workflow and remove redundant push trigger from test-application workflow
2026-05-10 11:34:27 +02:00
2025-10-04 18:18:26 +02:00
2025-09-17 20:43:17 +02:00
2025-09-08 12:39:36 +02:00

Discord Webhook 420 Notification App

This Python application sends notifications to a Discord channel via webhook every hour at HH:15 (5 minute reminder) and at HH:20.

Setup

  1. Install dependencies:

    pip install -r requirements.txt
    
  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, bot token, channel ID, and guild ID:

    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 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:

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+
  • Discord webhook URL

Docker

Build the Docker image from the provided Dockerfile:

docker build -t thc-webhook .

Run the container (pass your webhook URL via environment variable):

docker run -d \
  --name thc-webhook-app \
  -e DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/your_webhook_id/your_webhook_token" \
  thc-webhook

View logs:

docker logs -f thc-webhook-app

Stop and remove the container:

docker stop thc-webhook-app && docker rm thc-webhook-app

A docker-compose.yml is included for easy deployment. It reads DISCORD_WEBHOOK_URL from the environment. Create a .env next to the docker-compose.yml with your webhook URL or export the variable in your shell.

Example .env:

DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/your_webhook_id/your_webhook_token

Start the service:

docker compose up -d

Check service logs:

docker compose logs -f

Stop the service:

docker compose down

Notes

  • For production, prefer passing the webhook URL via a secret manager or Docker secrets rather than committing it to .env.
  • The container runs the app as a non-root user for improved security.
  • Use your system's Docker service (Docker Desktop, Docker Engine) to manage images and containers.
S
Description
No description provided
Readme 1 MiB
Languages
Python 99.2%
Dockerfile 0.8%