mattdeboard / rs-pugbot

A Discord bot for administering pick-up games & persistent user rating tracking based on match outcomes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🦀 PugBot 🦀 mattdeboard

Overview

rs-pugbot is a Discord bot built to administer custom matches in gaming, and provide a ranked ladder for the Discord's members to compete on.

Features

These are covered in detail in MILESTONES.md.

Installation Prerequisites

  1. Make sure you're running Rust's stable toolchain. This can be installed via rustup:
$ rustup toolchain install stable
  1. You will need a database server up and running. I recommend PostgreSQL, and all documentation is written assuming PostgreSQL.

    • (Postgres) You will need to add a role for the pugbot user. What I did was this:
    CREATE ROLE pugbot SUPERUSER LOGIN PASSWORD 'password';
  2. Install diesel_cli. See here for more information, but the below should get you going:

cargo install diesel_cli --no-default-features --features postgres
  1. You will also need a .env file. At the time of this writing (May '21), three key-value pairs are read from this file:
    • TEAM_COUNT: How many teams there are in a given game
    • TEAM_SIZE: How many players are on each team
    • DATABASE_URL: Connection string to the database, ex. postgres://pugbot:password@localhost:5432/pugbot
    • DISCORD_TOKEN: An OAuth2 token issued by Discord that the bot will use to connect to your server.
  2. You'll need an OAuth2 token for your bot from Discord. While there are official documentation, I found this blog post more to-the-point.

Linux

I have found that, on Linux Mint (and Ubuntu etc. probably) you'll need to install the following:

  • libssl-dev
  • libpq5
  • libpq-dev
  • gcc-multilib

sudo apt install -y postgresql libssl-dev libpq5 libpq-dev gcc-multilib

Tests

First, you'll need Rust's stable toolchain, installed via rustup:

$ rustup toolchain install stable

Then, you will need a .env file with DATABASE_URL and TEAM_COUNT attributes. Rename the file rename-this-to-.env to .env. (.env is in .gitignore so it won't be added to version control.)

Finally, run cargo test.

Contributing

Contributions from all skill levels welcome! I'm learning Rust as I go here so I welcome contributions from fellow newbs and salty experts alike. Please see the GitHub issues for open tasks.

License

Licensed under MIT license (LICENSE or https://opensource.org/licenses/MIT)

About

A Discord bot for administering pick-up games & persistent user rating tracking based on match outcomes

License:MIT License


Languages

Language:Rust 97.8%Language:PLpgSQL 2.0%Language:Shell 0.2%