A bot to remind us of what we'd all rather forget we said.
- Martin Petkov
Nostalgiabot II is the sequel to Nostalgiabot, originally written by Martin Petkov.
NB2 is a simple Flask app. You should be familiar with these technologies:
- Python, specifically 3.8
- Flask
- Flask-RESTful
git clone git@github.com:revangel/nostalgiabot2.git
mkvirtualenv nb2
workon nb2
Run the following to install all the Python dev dependencies:
pip install -r requirements/dev
Create a new .env file in the root directory of the project using .env.example as a template
cp .env.example .env
Do not commit this new file as it will contain secret keys!
Set FLASK_ENVIRONMENT
to development
. This enables the debugger and hot reloading.
We use pre-commit to manage and run linters and autoformatting on a git commit hook. To initialize pre-commit hooks, run the following:
pre-commit install
To initialize the SQLite database, run:
flask db upgrade
flask run
You should now see a url in your console pointing you to where NB2 is running
-
Create a new bot and assign it to a workspace https://api.slack.com/apps?new_app=1
-
Enable socket mode.
- Generate a token with
connection:write
scope.
-
Copy the token and paste it under the
SLACK_APP_TOKEN
variable in your local.env
file. -
Enable event subscriptions and subscribe to the
app_mention
bot event.
- Under
OAuth & Permissions
, install to workspace.
- Set the following bot scopes:
app_mentions:read
,chat:write
,users:read
- Copy
Bot User OAuth Token
and paste it under theSLACK_BOT_TOKEN
variable in your local.env
file.
- Under
Basic Information
copy theSigning Secret
and paste it under theSLACK_SIGNING_SECRET
variable in your local.env
file.
- The bot should be ready to use and can now access the running Flask server.