Git Product home page Git Product logo

mattybot's Introduction

mattybot

Current Slash Commands:

/score This is basically mattybot's equivalent of a hello world command

/get-standings [team_name] Running this returns a table of the current wins and losses. Optionally, you can provide a team name, and then stats will only be shown for that team.

Local Setup

This is our simple (for now) slackbot. If you'd like to contribute, here's how you get started.

Python Stuff

After pulling the repo, you'll want to create a venv. Once you've done so, activate it a pip install the requirements.

Secrets

For slack to be able to communicate with mattybot, we need to be able to verify requests. You'll find secrets.yml.template in the route of this project. Run

cp conf.d/secrets.yml.template conf.d/secrets.yml

and replace the fake values with real ones. Currently this file is a bit bloated and we're only really using the signing_secret but those other values might come in handy later on.

Running the server

At this point, you're ready to boot up the bot. This can be done by running

DEBUG=True python bot.py

however, you won't be able to do much.

I highly recommend installing ngrok! It'll allow you to expose the flask port to the open web so that the slack API can hit your python process. Once you have it installed, run it in a separate terminal window:

ngrok http 5000

You'll get a forwarding URL which you can set in the slack API UI.

Deploying

For now, I'm using zappa to automate the lambda deploys, hence the zappa_settings.json. Currently, I'll be the only one doing this, so this next bit is mostly for me. The zappa_settings.json currently only has a dev env so zappa update dev will get the latest code up into AWS.

Reading list

I can't get over how easy this was. Here are some posts I used to get this up in the cloud and running:

  1. Serverless Slash Commands with Python by Renzo Lucioni
    • This post also clued me into ngrok which was super helpful for debugging and testing
  2. Verifying Requests from Slack
    • This post by Jani Karhunen was crucial as well, because the first resource uses the old verification system that slack encourages you not to use.

mattybot's People

Contributors

dvfeinblum avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.