/UMass-Events-Discord-Bot

A Discord bot that posts today's events at UMass Amherst from http://www.umass.edu/events/

Primary LanguageRustMIT LicenseMIT

UMass Events Bot

builds.sr.ht status

A Discord and Telegram bot written in Rust to enable easy access to a variety of University of Massachusetts, Amherst services. Currently, it provides the ability to search across the dining halls to check which foods are present on a given day, as well as information on room availability to ease studying.

For the issue tracker, see https://todo.sr.ht/~gbear605/umass_bot

Usage

To add it to your server, go to this link and authorize the bot.

Development

The program requires a bot token to connect to Discord or Telegram. It does this using private token files (discord_token and telegram_token respectively) which can be acquired from Discord and Telegram.

Crosscompiling for Linux

Using: https://github.com/emk/rust-musl-builder

Docker needs to be installed.

  1. Set the alias for the builder:

alias rust-musl-builder='docker run --rm -it -v cargo-git:/home/rust/.cargo/git -v cargo-registry:/home/rust/.cargo/registry -v "$(pwd)":/home/rust/src ekidd/rust-musl-builder:nightly-2019-06-08'

  1. Start the Docker daemon (if it isn't already running)

  2. Set up the file cache: (speeds up build time)

rust-musl-builder sudo chown -R rust:rust /home/rust/.cargo/git /home/rust/.cargo/registry

  1. Build: (this will download a linux docker image to compile in if it is not already downloaded)

Expect the build step to initially take about fifteen minutes, then to take a while (roughly a minute) each time after the first.

rust-musl-builder cargo build --bin telegram_client --release rust-musl-builder cargo build --bin discord_client --release rust-musl-builder cargo build --bin server --release

To update the container, run docker pull ekidd/rust-musl-builder:nightly-2019-06-08

The built files will be in target/x86_64-unknown-linux-musl/release