This repository contains a python script running a Discord bot that fetches information from messages in forum channels and creates corresponding entries in a Notion database. It's designed to help with project management, allowing users to quickly transfer and track project details from Discord discussions to a structured Notion database.
Before you begin, ensure you have the following:
Clone this repository to your local machine using:
git clone <repository-url>
cd <repository-directory>
If you're using VSCode, you should see a popup the first time you open the workspace asking you to install recommended workspace extensions. If not, install the equivalent extensions for your IDE.
The extension is all you'll need to see yellow warning squiggles in your editor, but if you'd like to run the linter from the command line as well, instructions to install it are here: https://docs.astral.sh/ruff/installation/.
Currently, lint violations are not enforced on pull requests, but that may change in the future. Please try to avoid introducing new violations.
The configuration for Ruff can be found in ruff.toml
.
Create a new Conda environment using the environment.yml file included in the project:
conda env create -f environment.yml
This will create a new environment named projectbot with all the necessary Python dependencies installed.
Activate the newly created Conda environment:
conda activate projectbot
Create a secrets.yml file in the project directory with your Discord bot token and Notion integration details:
DISCORD_BOT_SECRET:
staging: "YOUR_DISCORD_BOT_TOKEN_FOR_TESTING"
prod: "YOUR_DISCORD_BOT_TOKEN_FOR_PRODUCTION"
AIRTABLE_TOKEN:
staging: "YOUR_AIRTABLE_TOKEN_FOR_TESTING"
prod: "YOUR_AIRTABLE_TOKEN_FOR_PRODUCTION"
OPENAI_API_KEY:
staging: "YOUR_OPENAI_API_KEY_FOR_TESTING"
prod: "YOUR_OPENAI_API_KEY_FOR_PRODUCTION"
Make sure to replace the placeholders with your actual tokens and IDs.
With the Conda environment activated and the secrets configured, start the bot by running:
python main.py
To deploy the bot on Heroku, follow these steps:
heroku login
heroku create <app-name>
heroku config:set DISCORD_BOT_TOKEN=YOUR_DISCORD_BOT_TOKEN
heroku config:set NOTION_INTEGRATION_TOKEN=YOUR_NOTION_INTEGRATION_TOKEN
heroku config:set NOTION_DATABASE_ID=YOUR_NOTION_DATABASE_ID
heroku config:set AIRTABLE_API_KEY=YOUR_AIRTABLE_API_KEY
heroku config:set AIRTABLE_BASE_ID=YOUR_AIRTABLE_BASE_ID
git push heroku main
heroku ps:scale worker=1
Your bot should now be running on Heroku.