A slackbot for Blank FPL league
Requirements: .NET Core 3.1 SDK: https://dotnet.microsoft.com/download/dotnet-core/3.1
..or using docker:
- see
/src/buildimage.sh
andruncontainer.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
The Blank instance:
- Heroku: https://dashboard.heroku.com/apps/blank-fplbot/
- Slack-app: https://api.slack.com/apps/AREFP62B1
A .NET Standard 2.0 library for integration to the Fantasy Premier League APIs
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);
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
- 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