A Discord bot that integrates with Notion for updates and notifications.
-
Clone the repository or copy the necessary files:
git clone https://github.com/BloomGameStudio/NotionDiscordIntegration.git
-
Create and configure the environment variables:
- Copy
.env.example
to.env
- Fill in the required values:
DISCORD_BOT_TOKEN=your_discord_bot_token NOTION_TOKEN=your_notion_token DB_PASSWORD=your_database_password NOTION_DATABASE_ID=your_notion_database_id NOTION_NOTIFICATION_CHANNELS=channel_id1,channel_id2
- Copy
-
Make sure Docker and Docker Compose are installed on your system
-
Start the containers:
docker-compose up -d
-
Check the logs:
docker-compose logs -f bot
-
Install the Heroku CLI and login:
heroku login
-
Create a new Heroku app:
heroku create your-app-name
-
Add the Heroku Postgres addon:
heroku addons:create heroku-postgresql:mini
-
Configure environment variables:
heroku config:set DISCORD_BOT_TOKEN=your_discord_bot_token heroku config:set NOTION_TOKEN=your_notion_token heroku config:set NOTION_DATABASE_ID=your_notion_database_id heroku config:set NOTION_NOTIFICATION_CHANNELS=channel_id1,channel_id2
-
Deploy to Heroku:
git push heroku main
-
Ensure the worker is running:
heroku ps:scale worker=1
-
Install dependencies:
pip install pipenv pipenv install --dev
-
Run the bot:
heroku local
Variable | Description | Required | Default |
---|---|---|---|
DISCORD_BOT_TOKEN |
Discord Bot Token | Yes | - |
NOTION_TOKEN |
Notion Integration Token | Yes | - |
DB_PASSWORD |
Database Password | Yes | - |
NOTION_DATABASE_ID |
Notion Database ID | No | Default in settings |
NOTION_NOTIFICATION_CHANNELS |
Discord Channel IDs | No | Default in constants |
DATABASE_URL |
Full Database URL | No | Constructed from other vars |
If you need to migrate existing data to a new Heroku deployment:
-
Ensure your local Postgres database is running:
docker-compose up -d db
-
Verify your environment variables are set:
# Local database connection export DATABASE_URL=postgresql://notion_bot:your_local_password@localhost:5432/notion_bot
-
Run the migration script:
# Activate the virtual environment pipenv shell # Run the migration python -m src.scripts.migrate
-
Verify the migration:
python -m src.scripts.query