Skip to content

League of Legends Stats Bot for Discord. Also has some other functions for general usage.

License

Notifications You must be signed in to change notification settings

Vertana/lolresearchbot

Repository files navigation

Readme

This program costs $900000 dollars

Running Without Building

  1. Ensure Docker is installed.

  2. Change _configuration_EXAMPLE.json to _configuration.json and fill in the values as appropriate.

  3. Then run the following command (assuming you placed that config file in your home folder):

sudo docker run -v ~/_configuration.json:/data/_configuration.json registry.gitlab.com/vertana/lolresearchbot/master:latest

Installation

Prerequisites

This project was built with .NET Core and made to be cross platform. More information on installing this prerequisite can be found on the Microsoft website. You will also require libgdiplus. If you are running Linux, building may require the installation of libunwind8.

Using homebrew on MacOS this can be installed via Homebrew with

brew update
brew tap caskroom/cask
brew cask install dotnet
brew install mono-libgdiplus

Build

Inside the folder run "dotnet build" to create debug executables, or "dotnet run" to run the executables. In order to create portable exectuables you need to run "dotnet publish" and it will create the executables for your particular host operating system under the "$project/bin/$platform" folder.

In order to create something more portable it is advised to build the program in this manner:

dotnet publish lolresearchbot.csproj -c Release -r ubuntu-x64

There are other runtime identifiers if you are building for a different platform other than 64-bit Ubuntu. Please refer to the NET Core documentation for them.

After it is built, the bot expects a _configuration.json file with the following layout (replacing X with your appropriate API key for the appropriate service). The configuration file must be placed either in the directory containing the executable or if you're using the Docker deploy method, the file is expected to be placed at /data/_configuration.json. Notably the cache size is in MB.

{
  "tokens":
    {
      "discord": "X",
      "SMMRY": "X",
      "LeagueofLegends": "X"
    },
    "systemOptions":
    {
      "imageFolder": "/tmp/images",
      "cacheSize": 500
    },
    "LeagueofLegendsOptions":
    {
      "RateLimitPer10S": "X",
      "RateLimitPer10M": "X"
    }
}

Deploy on Docker

Once you have published the application, go to the published application location (the folder just above $app/publish)and run the following commands to deploy (remove sudo if docker daemon is not running as root)

sudo docker build -t ImageName .
sudo docker run -d -t ImageName

Some Docker Usage Commands

The following command will stop and remove all docker containers using the image

sudo docker rm $(sudo docker stop $(sudo docker ps -a -q --filter ancestor=leaguebot.dock --format="{{.ID}}"))

To stop the container without removing it

sudo docker stop CONTAINER.ID

To list all the docker containers

sudo docker ps

Usage

Once this is done, the bot can be run by either running the executable directly or utilizing Docker run. The bot takes in the commands listed throughout the Modules folder via Discord either through a direct message to the bot or with an "@mention command arguments" message in a channel. "@bot help" will list available commands.

To run as a Docker container:

sudo docker run -v /local/location/_configuration.json:/data/_configuration.json -d -t ImageName

Log Location

If the bot is running in a Docker container the logs will be located in "/data/logs/". If it is not running in a Docker container the log will be located in the folder containing the bot executable.

About

League of Legends Stats Bot for Discord. Also has some other functions for general usage.

Resources

License

Stars

Watchers

Forks

Packages

No packages published