"""
Discord — Webhook Message Demo
===============================
A minimal, ready-to-run example of posting to a Discord channel webhook.

Get a webhook URL (free, no API key needed):
    1. In a Discord server you manage, open Server Settings -> Integrations.
    2. Click "Webhooks" -> "New Webhook", choose a channel.
    3. Click "Copy Webhook URL".

Setup:
    pip install requests
    export DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/..."

Run:
    python discord_demo.py
"""

import os
import requests


def post_message(content: str) -> int:
    """Post a message to a Discord channel and return the HTTP status code."""
    response = requests.post(
        os.environ.get("DISCORD_WEBHOOK_URL"),
        json={"content": content},
    )
    response.raise_for_status()
    return response.status_code


if __name__ == "__main__":
    status = post_message("Hello from krueng.ai 👋")
    print(f"Status: {status}")
