/lol-slack

League of Legends stats in Slack

Primary LanguageJavaScript

League of Legends stats in Slack

At work we use Slack for day-to-day business and shenanigans. We are also a bunch of avid League of Legends players. My idea was to combine the two and add LoL-stats straight in to our #gaming-channel!

Tech

Installation

Three environment variables need to be setup before starting.

LOL_GLOBAL=https://global.api.pvp.net/api/lol/static-data/{region}
LOL_BASE=https://eune.api.pvp.net/api/lol/{region}
RIOT_API_KEY=[YOUR-API-KEY]
$ git clone https://github.com/believer/lol-slack.git
$ cd lol-slack
$ npm install
$ npm start

This starts one POST route at http://localhost:3000/lol. So to test it post a JSON object on the form of for example:

{
  "text": "wins <summonerName>"
}

Testing

Slack have provided a great way for testing the message formatting right here. Each command also have a direct TRY IT link with a typical message and the response has a URL directly to the Slack formatting. This is how the message will look in the chat, instead of just looking at the JSON that the API reponds with ;)

Slash commands

The service responds to slash commands, i.e. /lol as a message. The available commands are listed below.

  • region = eune, euw, na and so on default: eune
  • platform = eun1, euw1, na1 and so on default: eun1

/lol freeToPlay

Displays the current champions who are free to play.

freeToPlay command

/lol help

Display the help message only to the user who requested the help. (Also responds if provided command does not exist)

help command

/lol latest <summonerName> <region>

Displays statistics from a summoner's latest game.

latest command

/lol league <summonerName> <region>

Displays division and stats for a summoner.

league command

/lol masteryScore <summonerName> <region>

Displays total mastery score of a summoner.

masteryScore command

/lol rankedMatches <summonerName> <region>

Displays ranked matches from the last 24 hours.

rankedMatches command

/lol status <region>

Displays the current status of the servers in a region.

status command

/lol team <summonerName> <region>

Displays the teams of a summoner.

team command

/lol topThreeChamps <summonerName> <region> <platform>

Displays the top three champions for a given summoner name.

topThreeChamps command

/lol wins <summonerName> <region>

Display the number of wins of a summoner.

wins command