Skip to main content

ModBot for Discord

ModBot is a Discord bot for mod.io using modio-rs and twilight. By adding ModBot to your Discord server, your community will be automatically notified whenever new UGC goes live.

Check out the Discord Bot Git Repo.

This guide covers:

ModBot examples

ModBot has a variety of functions (see Discord commands) that can be called in Discord. Below are a few examples of ModBot in action.

New UGC notification

Modbot can notify users when new UGC has been created.

Discord-ModBot-Notification-Example

UGC updates

ModBot can be used to notify when existing UGC has been updated.

Discord-ModBot-UGC-Details-Example

Setup

There are two ways you can go about setting up the ModBot. You can invite the officially hosted ModBot to join your Discord server (continue to "Simple setup" below), or you can build and install your own version of ModBot.

Simple setup

  1. Invite the ModBot using thje following URL: https://discordbot.mod.io/.

  2. View the games list /games and set the default game /settings default-game ID.

  3. In the channel(s) you want the bot to post updates (mod added / edited), run the command /subs add [GameID].

  4. Ensure the bot has Send Messages and Embed Links permissions in the channel(s) it is in to be able to function correctly.

Discord-ModBot-Roles

Discord commands

Once you have invited ModBot to your server, you can set the default game using the command /settings default-game ID.

Now when a user issues the command /mods, all of the UGC for the game you specified will be returned. You can change the default game at any time.

We recommend you also applying /subs add [GameID] to games you are interested in receiving push notifications from. For example in our #bot channel, we have subscribed to a bunch of games and whenever a mod is updated, the channel is notified.

Popular commands include:

  • /game return information about the default game

  • /games [search] return a list of all games

  • /mods [ID|Name] return a list of all mods belonging to the default game

  • /popularreturn a list of mods ordered by popularity

  • /settings default-game < ID|Name > set the default game

  • /subs add [ID|Name] [Tag..] [Type] subscribe to a game for updates (mods added/edited)

    EG:

    /sub add 51
    /sub add OpenXcom
    /sub add OpenXcom tags:"UFO Defense",Major
    /sub add "Skate XL" tags:"Real World Spot"
    /sub add Skate* tags:Gear,Deck
  • /subs list see all games subscribed too

  • /subs rm < ID|Name > [Tag..] [Type] unsubscribe from a game

    EG:

    /subs rm 51
    /subs rm OpenXcom
    /subs rm OpenXcom tags:"UFO Defense",Major
    /subs rm "Skate XL" tags:"Real World Spot"
    /subs rm skate tags:Gear,Deck
  • /subs mods mute < Game > < Mod > mute a mod from update notifications

  • /subs mods muted return a list of all muted mods

  • /subs mods unmute < Game > < Mod > unmute a mod from update notifications

Building

ModBot is written in Rust, so you'll need to grab a Rust installation in order to compile it.

Building is easy:

$ git clone https://github.com/nickelc/modio-bot
$ cd modio-bot
$ cargo build --release
$ ./target/release/modbot

Building with bundled sqlite3

Une the feature sqlite-bundled to compile sqlite3 from source and link against that.

$ cargo build --features sqlite-bundled

Installation

Install latest version from https://crates.io.

$ cargo install modbot
$ $HOME/.cargo/bin/modbot

Install modbot from the master branch.

$ cargo install --git https://github.com/nickelc/modio-bot
$ $HOME/.cargo/bin/modbot

Usage

Create a bot.toml config file in the working directory.

[bot]
token="your discord bot token"
database_url="/path/to/sqlite.db"

[modio]
api_key="your mod.io api key"

A example is provided as bot.example.toml.

Running the bot

./path/to/modbot

./path/to/modbot --config path/to/bot.toml

Logging

Logging can be configured via environment variables.

RUST_LOG=modio=debug,modbot=debug

Metrics

By default, the metrics are exposed via Prometheus endpoint listing on http://127.0.0.1:8080/metrics.

[metrics]
addr = "127.0.0.1:3000"

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.