Skip to content
This repository was archived by the owner on Feb 3, 2024. It is now read-only.

ComputerScienceHouse/QuotefaultBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSH Quotefault Bot

A Flask Slack bot API to interface with CSH Quotefault.

Python 3.6 Travis License Contributions welcome

What's Quotefault?

Computer Science House (CSH) has a weekly newsletter named Segfault, which is commonly distributed with an out of context quote from some member. Historically, these quotes were submitted by email, but since the email aliases is generally given to a different member every year, there is no central, accessible repository for quotes. Because of this, many wonderful quotes are unrecoverable. To mitigate this problem, an annual CSH hackathon, Nicholas Mercadante created Quotefault, a service for submitting, storing, and viewing quotes. Quotefault has since become quite prevalent, and so during another hackathon, Skyler Clark and Devin Matté created the Quotefault API to allow more projects to build off of quotefault.

How's this built?

This bot is built in Python Flask. It handles a POST request from Slack, interprets the quote request, and responds with a quote in channel, or an ephemeral help message if the command isn't understood. It uses the Quotefault API to interact with the Quotefault database.

Why build this?

This project provided an opportunity to play with Python Flask and the Slack API, and Quotefault had previously been floated as a possible slack integration. I wanted a project for the summer, so I

Contributing

Contributors welcome! Make a PR, and it will be checked with Travis and Pylint. You'll need to make it pass Pylint before it can be merged.

Setup

  1. Make sure you have python3 installed (Here's a guide)
  2. You'll need pip (pip3), the python package manager (Here's that guide)
  3. Run these commands to setup virtualenv and install the project dependencies to that virtualenv. This way you can have specific versions for each project without installing everything to your system.
python3 -m virtualenv venv # Sets up virtualenve in the venv directory in your working directory
source venv/bin/activate # Activates the virtual environment
pip install -r requirements.txt # Installs all of the dependencies listed in the requirements to the virtualenv
  1. Set up your configuration file:
  • Copy config.env.py to config.py
  • Set SERVER_NAME = 127.0.0.1:5000, which is where flask will serve to. This needs to be set or else flask gets upset. You can fill in other fields if you get an api key or you're running a local mySQL DB, but they aren't strictly necessary if you aren't going to manually emulate Slack sending slash commands.
  • Set debug mode: export FLASK_ENV=development
  • If flask doesn't find app.py, run export FLASK_APP=app.py
  • Run with flask run
  1. Make your changes, make sure it runs, and make a pull request. If you need some help with that, either checkout GitHub's guide or ping me on Slack or something.
  2. Make sure your PR passes pylint, and I should merge it or message you (or comment) about any comments I have. If I don't, poke me on Slack.

If you want to check style before making a PR, you can run pylint csh_quotefault_bot (or pylint -f colorized csh_quotefault_bot for the prettier version).

About

A Flask Slack bot API to interface with CSH Quotefault.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages