Skip to content

revangel/nostalgiabot2

Repository files navigation

Nostalgiabot II

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.

Tech Stack

NB2 is a simple Flask app. You should be familiar with these technologies:

Development Setup

Clone the repository

git clone git@github.com:revangel/nostalgiabot2.git

Setup virtual environment

mkvirtualenv nb2
workon nb2

Dependencies

Run the following to install all the Python dev dependencies:

pip install -r requirements/dev

Environment & Configs

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.

Precommit & Linting

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

Database

To initialize the SQLite database, run:

flask db upgrade

Run the bot

flask run

You should now see a url in your console pointing you to where NB2 is running

Steps to Create Slack Bot

  1. Create a new bot and assign it to a workspace https://api.slack.com/apps?new_app=1

  2. Enable socket mode.

Socket Mode

  1. Generate a token with connection:write scope.

App Token

  1. Copy the token and paste it under the SLACK_APP_TOKEN variable in your local .env file.

  2. Enable event subscriptions and subscribe to the app_mention bot event.

Event Subscription

  1. Under OAuth & Permissions, install to workspace.

Install

  1. Set the following bot scopes: app_mentions:read, chat:write, users:read

Bot Scopes

  1. Copy Bot User OAuth Token and paste it under the SLACK_BOT_TOKEN variable in your local .env file.

Bot Token

  1. Under Basic Information copy the Signing Secret and paste it under the SLACK_SIGNING_SECRET variable in your local .env file.

Signing Secret

  1. The bot should be ready to use and can now access the running Flask server.

About

Nostalgiabot II

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages