A Discord bot that:
- Checks the scan status of a UUID in the ODIN Threatfeed API.
- Fetches and summarizes 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
/checkcommand 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.).
-
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:
- The
/check <UUID>command and threat feed access require a valid ODIN API key. - You must also set your Discord server's Guild ID and the channel ID you want the bot to monitor.
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
- The
-
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_IDenvironment 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:
/healthThe 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 todayThe 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-20The 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/.