Skip to content

Installation

tritonas00 edited this page Dec 29, 2022 · 38 revisions

Table of Contents

Introduction

This page will guide you though the setup of the Rigs of Rods multiplayer bot. This tutorial assumes you have a RoRNet 2.44 server already setup and running. If not, see the Multiplayer server setup page.

Prerequisites

  • Windows or Linux system (e.g. Arch Linux)
  • RoRNet 2.44 multiplayer server
  • Python 3.8 or higher
  • discord.py v2.0 or higher, requests
  • Discord server
  • A brain, basic computer knowledge, and some patience

Discord server

To provide server output and control, the bot connects to an Discord server via a Discord Bot. You can create your own server (How do I create a server) and a Bot (Creating a Bot Account). Also make sure to enable Privileged Intents.

Windows installation

Installing Python

First, Download the latest version of Python (3.9.4) for your OS type (64-bit or 32-bit):

64-bit

32-bit

Once downloaded, double-click to run the setup. Enable Add Python 3.9 to PATH and click Install Now.

python1

The installation of Python will begin. Once finished, click Close.

python2

Python has been installed.

Installing discord.py and requests

Open Command Prompt, type py -3 -m pip install -U discord.py requests and hit Enter.
After the installation is completed you may close the Command Prompt window.

Downloading the bot

Download the latest master branch zip from the GitHub page.

Extract the zip into a new directory that's easy to access, preferably in the same folder as your server files:

bot

Configuration

To setup the bot's configuration, see the Configuration page. Once you're done configuring, return to this page to run the bot.

Running the bot

Finally, to start the bot, double-click start_bot.bat.

If you get a Windows SmartScreen warning, click More info then Run anyway:

smart

If everything has been setup correctly, after a few seconds the bot should connect to Discord and join the server!

connect

connect

Linux installation

For this tutorial I will assume you're running Arch Linux.

Installing required packages

Install the required packages:

sudo pacman -S git python python-pip
python3 -m pip install -U discord.py requests

Downloading the bot

Get the master branch:

git clone https://github.com/tritonas00/RoRServerBot
cd RoRServerBot

Configuration

To setup the bot's configuration, see the Configuration page. Once you're done configuring, return to this page to run the bot.

Running the bot

Finally run the bot:

python -B services_start.py

The -B is important as it prevents the bot directory from being cluttered by .pyc files.

If everything has been setup correctly, after a few seconds the bot should connect to Discord and join the server!

Making the bot a server admin

In order for the bot to use moderation commands such as !kick or !ban, the bot must be an admin on your server.

First, open configuration.xml and find the following in the RoRclient section:

<user name="Services" token="515cf64ec28c445ca5786ec7122d7154" language="en_US" />

The token is like a password, it must be unique. To make it as unique as possible, use guidgenerator.com to generate a GUID.

Replace token="515cf64ec28c445ca5786ec7122d7154" with the GUID you generated. Example:

token="49b861b0-f5a1-4e1f-a5e5-461339bcdeb1" 

IMPORTANT: Do NOT use the example tokens to make your bot admin! This is the unhashed token, anyone could copy it into their RoR settings and become admin on your server!

Save the file and launch the bot.

Now open your server's log file (located in logs\server.log) and search for your bot's username. You should find the following:

New client: TestBot (en_US), using RoR_bot 2020.03, with token 7D2655CFF4038F1C67E40313F4B1676B27E05116

7D2655CFF4038F1C67E40313F4B1676B27E05116 is your bot's hashed token. Copy it as you'll need it for the next step.

Now open your server's auth file (located in config\server.auth) and add the following to the bottom of the file:

9 7D2655CFF4038F1C67E40313F4B1676B27E05116 botName

Replace 7D2655CFF4038F1C67E40313F4B1676B27E05116 with your hashed token and botName with your bot's username.

Save the file and restart your server. Your bot should now be admin!

BotAdmin

Troubleshooting

Bot doesn't connect to Discord

If the bot fails to connect to Discord, check your configuration's Discordclient section and discord channel ID.

Bot doesn't join RoR server

If the bot fails to connect to your RoR server, check the info in your configuration's RoRclient section. To test the same settings in-game, click Multiplayer -> Direct IP. and try connecting yourself using the same settings.

Other errors

If you receive an error not listed here, please create a thread in the correct support subforum or join our Discord server and describe your issue in the #support channel. Thanks!