All Projects → brainboxdotcc → triviabot

brainboxdotcc / triviabot

Licence: Apache-2.0 license
A Discord Trivia/Quiz bot with over 150,000 questions and lots of features!

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language
Raku
181 projects
PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to triviabot

qt raytracer challenge
Implementation based on the book The Ray Tracer Challenge
Stars: ✭ 18 (-21.74%)
Mutual labels:  cplusplus-17
thread-pool
BS::thread_pool: a fast, lightweight, and easy-to-use C++17 thread pool library
Stars: ✭ 1,043 (+4434.78%)
Mutual labels:  cplusplus-17
DPP
C++ Discord API Bot Library - D++ is Lightweight and scalable for small and huge bots!
Stars: ✭ 560 (+2334.78%)
Mutual labels:  dpp
BurgWar
Burg'war est un jeu de plateforme/combat multijoueur en 2D écrit en C++17/Lua avec mon propre moteur de jeu : Nazara Engine.
Stars: ✭ 43 (+86.96%)
Mutual labels:  cplusplus-17
gal
Geometric Algebra Library
Stars: ✭ 78 (+239.13%)
Mutual labels:  cplusplus-17
utf utils
My work on high-speed conversion of UTF-8 to UTF-32/UTF-16
Stars: ✭ 45 (+95.65%)
Mutual labels:  cplusplus-17
sporks
The source code repository for Sporks, the learning, backchatting, scriptable discord bot!
Stars: ✭ 30 (+30.43%)
Mutual labels:  dpp
MQA identifier
Master Quality Authenticated codec reverse engineering, Tool to identify MQA encoding and Master's Sample Rate
Stars: ✭ 89 (+286.96%)
Mutual labels:  cplusplus-17
windows-bot-template
A D++ Discord Bot template for Visual Studio 2019 (Windows x64 and x86) - Ready to go, just add your code!
Stars: ✭ 15 (-34.78%)
Mutual labels:  dpp
Magic enum
Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code
Stars: ✭ 2,340 (+10073.91%)
Mutual labels:  cplusplus-17
IwEngine
This is an engine that I initially started building after taking a game coding class in high school. I didn't like Unity so tried to make something more code focused that was personally easier to use.
Stars: ✭ 97 (+321.74%)
Mutual labels:  cplusplus-17
neworder
A dynamic microsimulation framework for python
Stars: ✭ 15 (-34.78%)
Mutual labels:  cplusplus-17
ra-ra
A C++20 array / expression template library with some J/APL features
Stars: ✭ 22 (-4.35%)
Mutual labels:  cplusplus-17
CppNow2018
Materials from my talks from C++Now 2018
Stars: ✭ 20 (-13.04%)
Mutual labels:  cplusplus-17
jni-bind
JNI Bind is a set of advanced syntactic sugar for writing efficient correct JNI Code in C++17 (and up).
Stars: ✭ 42 (+82.61%)
Mutual labels:  cplusplus-17
morphologica
A library of supporting code for numerical modelling (JSON config, HDF5 data, Modern OpenGL visualization)
Stars: ✭ 118 (+413.04%)
Mutual labels:  cplusplus-17
combatris
A "perfect" implementation of an old classic
Stars: ✭ 20 (-13.04%)
Mutual labels:  cplusplus-17
any invocable
Сonservative, move-only equivalent of std::function
Stars: ✭ 14 (-39.13%)
Mutual labels:  cplusplus-17
cpp-tutor
Code examples for tutoring modern C++
Stars: ✭ 52 (+126.09%)
Mutual labels:  cplusplus-17

TriviaBot, the discord bot with over 150,000 questions!

This project contains the source code for the Brainbox.cc TriviaBot. Written in C++17 using the D++ library.

It was originally FruitLoopy Trivia on irc.chatspike.net and i've been running this bot in some form since 2004.

This source code repository is for reference and learning only as it won't work without a TriviaBot API key, which i'm not prepared to give out to people (no, this isn't "open trivia database"). Without this key, the bot will start, but will be unable to start any games, or retrieve any statistics or update the cache.

Project and System status

Discord Dashboard Codacy Badge CircleCI

Service Status

Listing Badges

Discord Bots DiscordBotList Bots for Discord

Supported Platforms

Currently only Linux is supported, but other UNIX-style platforms should build and run the bot fine. I build the bot under Debian Linux 10.

Dependencies

  • cmake (version 3.16+)
  • g++ (version 8.3+)
  • D++ (10.0.18 or later)
  • PCRE (whichever -dev package comes with your OS)
  • MySQL Connector/C++ (1.1.12 or later from the MySQL community apt repository)
  • fmtlib (8.1.1)
  • spdlog (latest master branch)

Setup

1. Build Source Code

mkdir build
cmake ..
make -j8

Replace the number after -j with a number suitable for your setup, usually the same as the number of cores on your machine.

2. Setup Database

You should have a database configured with the mysql schemas from the mysql-schemas directory. use mysqlimport to import this. Note that the database schema included only has the bare minimum tables to boot the client bot. There is no question database structure, or API schema included in this dump.

3. Edit Configuration File

Edit the config-example.json file and save it as config.json. The configuration variables are documented below:

Key Name Description
devtoken Discord bot token for a development version of the bot, allowing you to keep development and live copies separate
livetoken Discord bot token for live version of the bot (see above)
shardcount Number of shards in total, split across clusters
dbhost Hostname or IP address of MySQL server where the triviabot client schema is hosted
dbuser Username for MySQL server
dbpass Password for MySQL server
dbname Database name for MySQL database on the server containing the triviabot schema
dbport TCP Port number for the MySQL server
test_server The test server is the only server which will respond to commands, if the bot is started with the -test command-line argument
utr_readonly_key Readonly API key for uptimerobot, used to update status pages if you are using uptimerobot to monitor uptime
error_recipient E-Mail address to receive core files in the event of a client crash (!)
owner Snowflake ID of the bot owner. There can only be one bot owner
apikey TriviaBot API key. This is NOT an Open Trivia Database key. Speak to Brain#0001 about API keys.
modules A list of modules to load. Be sure to load the trivia module!
shitlist An array of snowflake IDs of guilds where trivia cannot be started. Instead, the person issuing the !trivia start command
will get a friendly message encouraging them to invite the bot to their own server. Put places like bot lists in here.

4. Start Bot

Before the initial startup, you should first make a log directory inside your build directory:

mkdir my-bot-dir/build/log

Once this is done, you will be able to start the bot so long as you've set up the database and configuration file, above.

cd my-bot-dir
./run.sh

run.sh will restart the bot executable continually if it dies. If the bot quits, run.sh will trigger mail-core-fire.sh which will email a coredump to the admin user, if GDB is installed.

Command line parameters

./bot [--dev|--test] [--members] [--clusterid <id> --maxclusters <n>]
Argument Meaning
--dev Run using the development token in the config file. Mutually exclusive with --test
--test Run using the live token in the config file, but squelch all outbound messages unless they originate from the test server (also defined in the config file)
--members Send a GUILD_MEMBERS intent when identifying to the discord gateway. Note that you'll need this after October 2020 for bots in over 100 servers.
--clusterid The id of this process in a cluster of maxclusters processes. Shards are equally shared between all clusters, e.g. if you have two clusters and ten shards each cluster process will have 5 shards on it.
--maxclusters Number of cluster processes to share shards across. You must launch at least this many processes, each of which has a unique cluster id between 0 and max - 1 as it's id using the --clusterid command line parameter

Version History

Version/Date Protocol Platform/Libraries Language Status
1.0 / 2004 IRC WinBot 2.3 WinBotScript (WBS) Discontinued
2.0 / 2005 IRC WinBot 2.7 PlugPerl (Perl 5.6) Discontinued
3.0 / 2005 IRC Botnix 1.0 Beta 1 Perl 5.6 Discontinued
4.0 / 2020 Discord Sporks, aegis.cpp C++17 Discontinued
5.0 / 2021 Discord Sporks, D++ C++17 Active

Known issues

  • libmysqlcppconn versions less than 1.1.12 will cause corruption of query results where any string or blob is over 64 bytes in size. This is fixed in versions of Connector/C++ provided with debian 11, but not debian 10. If you are on Debian 10, you must install the Connector/C++ from the mysql community repository, otherwise you can just do apt-get install libmysqlcppconn-dev.
  • You will have to configure your MySQL server to accept more concurrent connections if you run many clusters. Each instance of the bot will connect to MySQL 10 times to be able to run concurrent queries, as one connection only supports one ongoing query at a time.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].