A Discord bot for registering and tracking wallet addresses.
-
Install dependencies
pip install -r requirements.txt
-
Configure environment
Copy
.env.exampleto.env, then set:DISCORD_BOT_TOKEN— your Discord bot tokenDISCORD_CHANNEL_ID— the single channel where commands run and the bot sends messages (e.g.1465635325870211155)DISCORD_GUILD_ID(optional) — your server’s ID so slash commands appear right away (Developer Mode → right‑click server → Copy Server ID). If unset, commands sync globally and can take up to an hour to show.HEARTBEAT_CHECK_INTERVAL_SECONDS(optional, default300) — how often to run the node heartbeat check, in seconds.HEARTBEAT_STALE_THRESHOLD_SECONDS(optional, default1800) — send a DM if the node's last heartbeat is older than this many seconds.
-
Run the bot
python bot.py
Build and run with Docker (pass env from your .env file; use a volume if you want to persist registrations):
docker build -t blacklight-bot .
docker run --env-file .env --rm blacklight-botTo persist registrations across restarts:
docker run --env-file .env -v $(pwd)/data:/app/data --rm blacklight-botOr use Docker Compose (builds, loads .env, and mounts a data directory so registrations.json is stored as a file inside it):
docker compose up -d| Command | Description |
|---|---|
/register <wallet_address> |
Register a wallet address to your Discord account |
/unregister <wallet_address> |
Unregister a wallet you previously registered |
- Wallet registrations are persisted in
data/registrations.json. /registerand/unregisteronly work in the channel set byDISCORD_CHANNEL_ID; in other channels the bot replies that the command must be used in the designated bot channel.- The bot runs a heartbeat check every
HEARTBEAT_CHECK_INTERVAL_SECONDS(default 300). For each registered node it calls the Blacklight API; if the latest heartbeat is older thanHEARTBEAT_STALE_THRESHOLD_SECONDS(default 1800), it DMs that message to every user who registered that node.