A Discord bot that extracts messages from all channels over the last 7 days and updates from Pipedrive. Then it uses OpenAI models to generate summaries, which are then printed to the console and saved to Notion.

- Extracts all messages from all channels for the past 7 days
- Properly handles threaded messages and organizes them hierarchically
- Customizes prompts for different channel types (announcements, general, help, development, etc.)
- Uses OpenAI models to generate comprehensive summaries
- Prints summaries to the console and saves them to Notion
- Python 3.8 or higher
- A Discord bot token
- An OpenAI API key
- A Pipedrive API key
- A Notion API key
- Clone this repository or download the source code
- Install dependencies:
pip install -r requirements.txt - Configure the bot:
- Edit the
.envfile to include your Discord token and OpenAI API key - Make sure your Discord bot has the necessary permissions (see below)
- Edit the
Your Discord bot needs the following permissions:
- Read Message History
- Read Messages/View Channels
- Send Messages (optional, this bot doesn't send messages to Discord)
When creating your bot on the Discord Developer Portal, make sure to enable the following "Privileged Gateway Intents":
- Presence Intent (optional)
- Server Members Intent (optional)
- Message Content Intent (required)
python run.py
The bot will connect to Discord, extract messages from all channels in all servers it has access to, generate summaries using GPT-4o, and print them to the console.
After processing all channels and threads, the bot will automatically exit.
You can customize the bot by editing the following variables in the .env file:
DAYS_TO_LOOK_BACK: Number of days to look back for messages (default: 7)
For more advanced customization, you can modify the channel-specific prompts in the generate_summary.py.
- The Discord API limits the rate at which messages can be fetched, so processing large servers may take time
- GPT-4o has a context limit, so very active channels may have their messages truncated for summarization
- The bot uses the OpenAI API, so be aware of usage costs
MIT