Skip to content

johnkors/fplbot

 
 

Repository files navigation

FPL bot

A slackbot for Blank FPL league

Build Release

Contributing

Requirements: .NET Core 3.1 SDK: https://dotnet.microsoft.com/download/dotnet-core/3.1

..or using docker:

  • see /src/buildimage.sh and runcontainer.sh using the .NET Core docker images

Configuration
Add a appsettings.Local.json file (is in gitignore) with contents:

{
  "Slackbot_SlackApiKey_BotUser": "token",  
  "fpl" : {
    "login" : "username",
    "password : "pwd"
  }
}

Or: Add environment variables (double underscores mimic nested props in the json config):

export Slackbot_SlackApiKey_BotUser=token
export fpl__login=username
export fpl__password=pwd 

Build scripts
The project is using Nuke to setup builds.

It can be run via the build scripts: /build/build.sh or /build/build.ps1

or using the Nuke CLI:

Install: $ dotnet tool install Nuke.GlobalTool -g
Run: $ nuke

Hosting

The Blank instance:

Artifacts

Fpl.Client

  A .NET Standard 2.0 library for integration to the Fantasy Premier League APIs

Nuget Nuget

Install:

$ dotnet add package Fpl.Client

Register via DI providing credentials to a user of the fantasy premier league:

services.AddFplApiClient(c =>
{
    c.Login = "youremail@premierleague.com";
    c.Password = "yourpassword@premierleague.com"
});

Or if you have the credentials in any other registered .NET Core configuration provider:

services.AddFplApiClient(hostContext.Configuration);

Fplbot docker image

dockeri.co

Install:

 docker pull fplbot/fplbot:latest

Run:

 docker run --rm \
 -e fpl__login=username \
 -e fpl__password=password \
 -e Slackbot_SlackApiKey_BotUser=token \
 -e fpl__leagueId=89903 \  # optional: which FPL league the `fpl` command should fetch data for. Defaults to the Blank league
 fplbot/fplbot

Slack app setup

  • Create a Slack app
  • Provide the following scopes:
    • chat:write:bot ("Send messages as fplbot")
  • Add a bot user, which will lead to the bot scope being added:
    • bot ("Add the ability for people to direct message or mention @fplbot")

FplBot is a Blank.no project

About

🤖Slackbot for Fantasy Premier League

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 95.4%
  • Shell 1.6%
  • Dockerfile 1.6%
  • PowerShell 1.4%