Manual Install Guide Contribute Questions Support it on Patreon + Invite

TriviaBot is open-source and can be downloaded for free. This guide shows you how to install TriviaBot on a Windows, Linux, or Android system. Note that installing TriviaBot using this method is completely optional for most cases. For general use, you can simply invite TriviaBot to your server directly.

If you enjoy using TriviaBot as a free and open source application, please consider supporting it on patreon.

Star

Download TriviaBot for Windows Download TriviaBot for Linux

Table of Contents

1. How to Install - Windows
1.1: Creating the bot account
1.2: Setting up the bot
1.3: Run the bot!
2. How to Install - Linux
2.0.1: Android Devices
2.0.2: Raspberry Pi/Raspbian OS
2.1: Creating the bot account
2.2: Setting up the bot
2.3: Run the bot!
3. Usage Instructions
3.1: Configuration
3.1.1: Game Configuration
3.1.2: Global Configuration
3.1.3: Maintenance Configuration
4. Setting Up Custom Questions

How to Install - Windows

Creating the bot account

  1. Log in to the Discord Developer Portal and click "Create an application". Name the bot anything you like. Write down the client ID as you will need it for later.
  2. On the left hand side, click "Bot". Now click the "Add Bot" button to create your bot. Now you can set an avatar for your bot if desired.
  3. Under "Token" click the link that says "click to reveal". This is the password for your bot's account. You'll need this and the Client ID number later. Copy them both somewhere safe or keep the tab open.
  4. Paste the URL listed below into your browser and replace "CLIENT_ID" with your client ID number. Hit enter and select the desired Discord server. Once this is done, the bot will show up in your server!
https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID&scope=bot

Setting up the bot

  1. Download the TriviaBot program and extract it somewhere on your system.
  2. Install Node.js LTS from this website.
  3. Once Node.js is finished installing, run install.bat in the bot's folder. This will automatically install the required modules for the bot.
  4. Right click the bot's config.json file and click "Edit".
  5. Find "your_token_here" and replace it with the Discord token from earlier.

Run the bot!

Once you complete all of this, you will be able to run the bot by opening run.bat. If you've done all of this correctly, you will see the following in the terminal: TriviaBot connected to 1 Discord Server.

Note that if you close this terminal the bot will be disconnected. In Windows, the bot can be run in the background with no terminal by opening run_silent.vbs.

You may want to create a shortcut to run.bat or run_silent.vbs in your Startup folder:

C:\Users\[YOURNAME]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

How to Install - Linux

Android Devices

The bot can be installed on Android devices using the Termux app. No rooting is required! Once installed, enter apt update and apt install nodejs curl. Then, proceed with the installation as a Linux system. You may need access to a desktop computer in order to create the bot account.

Raspberry Pi/Raspbian OS

TriviaBot can be run from a Raspberry Pi device by installing Node.js.

First, follow the Node.js install instructions found here under "Debian and Ubuntu based Linux distributions". Once this is done, you can proceed with the instructions below. You may need access to a desktop computer in order to create the bot account.

Creating the bot account

  1. Log in to the Discord Developer Portal and click "Create an application". Name the bot anything you like. Write down the client ID as you will need it for later.
  2. On the left hand side, click "Bot". Now click the "Add Bot" button to create your bot. Now you can set an avatar for your bot if desired.
  3. Under "Token" click the link that says "click to reveal". This is the password for your bot's account. You'll need this and the Client ID number later. Copy them both somewhere safe or keep the tab open.
  4. Paste the URL listed below into your browser and replace "CLIENT_ID" with your client ID number. Hit enter and select the desired Discord server. Once this is done, the bot will show up in your server!
https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID&scope=bot

Setting up the bot

  1. Open a terminal on your system.
  2. (Skip this step if installing to an Android or Raspberry Pi device.) Install Node.js and NPM. Install build tools if instructed. How to install via package manager.
  3. Type curl -L http://lakeys.net/triviabot/dl/triviabot.tar.gz > triviabot.tar.gz to download the bot's files to an archive named triviabot.tar.gz.
  4. Type tar -xzf triviabot.tar.gz to extract the archive. This will create a directory named "TriviaBot". Navigate to the directory with cd TriviaBot.
  5. Type sudo chmod +x run.sh. This gives you permission to execute run.sh. (If this does not work, try chmod +x run.sh)
  6. Type npm install to install the required packages for the bot to run.
  7. Open config.json in a text editor.
  8. Replace "your_token_here" with the Discord bot token from earlier.

Run the bot!

Once you complete all of this, you will be able to run the bot by executing run.sh (Navigate to the bot's directory and enter ./run.sh). If you've done all of this correctly, you will see the following: TriviaBot connected to 1 Discord Server.

Usage Instructions

Configuration

The bot can be configured by editing config.json. See below for documentation on the config options.

Game Configuration

Global Configuration

Maintenance Configuration

A lot of the options in this section are deprecated and/or unused. Here are the ones that are still in use:

Setting Up Custom Questions

One of the perks of self-hosting TriviaBot is that you can add your own questions! Here's how:
  1. Open your config.json and look for "databaseURL". Replace https://opentdb.com with file://./Questions. You can use a different file path if desired.
  2. Enter the questions folder. Inside, you'll find a sample database. The sample database shows you how to format your questions and categories.
  3. Open the categories.yml file in a text editor. Here, you can add, delete, and edit categories as needed. When creating a new category, make sure you have a matching file for it, named questions_ID.yml.
  4. Now edit the question files for your new categories. The included files, named "questions_0.yml", "questions_1.yml", and "questions_2.yml" all contain sample questions.
  5. Replace the example quetions as needed and, following the same format, add your own.
  6. If you want to have the questions from the Open Trivia Database along with your custom questions, enter the bot's config.json file and change "database-merge" to true.
  7. Now start the bot and test your questions! Typing "trivia help" and "trivia categories" will show you how many questions you have added.