This repository contains the code for Blert.io's official Discord bot.
/link-discord: Instructions to generate a linking code on https://blert.io/verify <code>: Validates the code and links the Discord account
/issue: Generate GitHub issue drafts from recent chat context/grant-api-access <user>: Allow a linked Discord user to create API keys
Set these environment variables to run the bot:
DISCORD_TOKEN: Bot tokenBOT_USER_ID: Discord user ID for this botBLERT_DISCORD_BOT_SECRET: Shared secret for admin API callsBLERT_ADMIN_API_BASE: Optional override for the admin API base URLBLERT_GUILD_ID: Discord server where slash commands are registeredBLERT_ADMIN_ROLE_IDS: Comma-separated role IDs allowed to grant API accessBLERT_ADMIN_USER_IDS: Comma-separated user IDs always treated as adminsPROMPTS_DIR: Directory containing prompt files (defaultprompts)SQLITE_DB_PATH: Path to the SQLite database for user dataGITHUB_APP_ID,GITHUB_PRIVATE_KEY_PATH: GitHub App credentials
All commands must be run from within the venv.
. .venv/bin/activateTo register or refresh slash commands:
python bot.py --sync-commandsDuring development, this syncs commands directly to the guild specified by
BLERT_GUILD_ID. To remove the guild-specific versions later:
python bot.py --clear-guild-commandspython bot.pyThe bot loads prompt files and listens to Discord events using the configuration above.
Activate the virtual environment and run the unit tests:
python -m unittest discover tests