A Discord bot that:
- Checks the scan status of a UUID in the ODIN Threatfeed API.
- Fetches the full ODIN threat feed.
- Summarizes channel conversations by user and topic for a given date.
- Responds to health checks and logs all activity.
- /check : Query the ODIN Threatfeed API and report if the item has been scanned.
- /health: Check if the bot is operational.
- Threat Feed Access: The agent can fetch and summarize the full ODIN threat feed when requested.
- Message Summarization: When mentioned with a request for a summary (optionally specifying a date or user), the bot summarizes the main topics discussed by each user in the channel for that date.
- Logging: All agent traces and errors are logged to
logs/
. - Local Summaries: Summaries are saved to
logs/discord_daily_summary_<date>.txt
.
- Hardware: Any system capable of running Python 3.11+
- Software:
- Python 3.11 or higher
- uv (for dependency management and running)
- A Discord account and a Discord server where you have permission to add bots
- A Discord Bot Token (Create one here)
- An ODIN API Key (for
/check
command and threat feed access)
To install the bot for regular use (runtime dependencies only):
uv pip install -e .
To install the bot with all development and test dependencies:
uv pip install -e '.[test]'
This will install all runtime and test dependencies (pytest, pytest-asyncio, pytest-mock, etc.).
The bot can also be run using Docker Compose, which launches both the ODIN bot and the MCP Discord server in separate containers.
-
Docker and Docker Compose installed on your system
-
Environment variables for the OpenAI API key, the Discord server's Guild ID and the channel ID you want the bot to monitor. Should you want to access the 0DIN API, you will also need a key for that.
export OPENAI_API_KEY=your-openai-api-key-here export DISCORD_TOKEN=your-bot-token-here export ODIN_API_KEY=your-odin-api-key-here export GUILD_ID=your-discord-guild-id-here export CHANNEL_ID=your-discord-channel-id-here
make up
This command will:
- Build the ODIN bot Docker image
- Pull the MCP Discord server image from Docker Hub
- Launch both containers using Docker Compose
- The MCP Discord server will be available on port 8080
make down
make build
- Build the ODIN bot Docker imagemake run
- Run the ODIN bot container directlymake debug
- Run the ODIN bot container with an interactive shell for debugging
-
Clone this repository and enter the directory:
git clone git@github.com:ividal/0din-bot.git cd 0din-bot
-
Install the package (see Installation section above).
-
Create a Discord bot and get your token:
- Go to the Discord Developer Portal
- Create a new application, add a bot, and copy the bot token
- Invite the bot to your server using the OAuth2 URL generator (scopes:
bot
, permissions:Send Messages
,Read Messages
)
-
Set your environment variables: See the instructions above, in the "Docker setup" section.
-
Run the bot:
uv run odinbot agent --guild-id $GUILD_ID --channel-id $CHANNEL_ID
- Make sure you have set the
DISCORD_TOKEN
,ODIN_API_KEY
,GUILD_ID
, andCHANNEL_ID
environment variables as described above. - The bot will start and monitor the specified channel in your server.
- Make sure you have set the
-
Check a UUID:
In any channel the bot is in, use the slash command:/check <UUID>
The bot will reply with the scan status from the ODIN Threatfeed.
-
Health Check:
/health
The bot will reply if it is operational.
-
Access Threat Feed:
Mention the bot and ask about the threat feed, e.g.:@Bot show me the threat feed @Bot what's in the threat feed today
The bot will fetch and summarize the current ODIN threat feed.
-
Summarize Channel Messages:
Mention the bot and request a summary, e.g.:@Bot summarize today's messages @Bot summarize messages from 2024-03-20 @Bot summarize messages from user Alice on 2024-03-20
The bot will reply with a summary of topics by user for the specified date and save the summary to a log file.
- Tests are located in
tests/
. - To install test dependencies, use:
uv pip install -e '.[test]'
- To run the tests:
uv run pytest tests/
- All logs and summaries are saved in the
logs/
directory. - The bot will only respond to direct mentions or slash commands.
- For development and debugging, all agent traces are saved as JSON in
logs/
.