Git Product home page Git Product logo

fantasy-bot's Introduction

Fantasy Football Bot

A lambda function that (a) sends fantasy football updates via GroupMe on a Cron job and (b) sends alerts when the trigger phrase (!update or !injury report) is sent in the group.

This is a Typescript lambda function that hits the ESPN fantasy football API to request updates before sending messages using the GroupMe API. Infrastructure lives in AWS and is defined/deployed using AWS CDK.

Setup

Use this link to create a GroupMe bot, and copy the bot ID.

This API connects to the ESPN Fantasy Football API. To find your league ID, click on your league online and the url should change to

https://fantasy.espn.com/football/league?leagueId=[your league ID here]

Create a .env file in the root directory and add those IDs:

GM_BOT_ID=abcd1234
FF_LEAGUE_ID=1234567

In the root fantasy-bot/ directory:

cd lambda
npm install      // download lambda's dependencies
cd ..
npm install      // download cdk's dependencies
npm run build

This will download npm modules for both the infrastructure and the lambda code itself, and compile the typescript to javascript.

Making Changes

The bin directory contains the binary that creates the Cloudformation stack, and the lib folder is where you'll build the stack itself.

Whether you change the lambda or the infrastructure, simply run npm run build from the root directory.

Deploy

Run cdk deploy. This will deploy / redeploy your Stack to your AWS Account.

You'll need to download the CDK CLI if you don't have it already:

npm install -g aws-cdk

Commands

  • npm run build compile typescript to js
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth prints the generated CloudFormation template

fantasy-bot's People

Contributors

dannyhines avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar  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.