Ronhorn is Longhorn Riichi's Discord Bot, which supports two categories of slash commands:
/register
, /enter_score
, etc.)/skill
, /parse
, etc.)The documentation for the Discord slash commands can be found here
It also has a passive component that automatically tracks and records online games played in the club's Mahjong Soul lobbies, which is a more advanced version of that of the UvUManager.
bot.py
: entry point of the Discord bot. Does the following:
global_stuff.py
, which does the following:
config.env
AccountManager
/ext/
: Discord bot extensions (each extension is a suite of slash commands and their helper functions)
LobbyManagers
: has commands to pause, unpause, and terminate contest games from all 4 tournaments. Listens for finished games and records results. Automatically extends contest finish_time and reconnects when necessary.Utilities
: various utilities, including recording in-person games, managing club membership, fetching links to player stats on external websites, etc.InjusticeJudge
: has commands that rely on the InjusticJudge submodule, and the helpers that make efficient API calls. Caches the game logs in /cached_games
, up to 1 GB./modules/
: modules to be imported into the above extensions
InjusticeJudge
: houses the InjusticJudge submodulepymjsoul
: a modified version of mjsoul.py that provides MajsoulChannel
, a class for interfacing with Mahjong Soul's APImahjongsoul
: contains two wrappers of MajsoulChannel
:
ContestManager
: logs into the Chinese Mahjong Soul contest management server to monitor club tournamentsAccountManager
: logs into the Chinese Mahjong Soul game server to directly fetch game results/recordsFirst, cp config.template.env config.env
.
New Application
).
SERVER MEMBERS INTENT
AND MESSAGE CONTENT INTENT
Discord Stuff
section of config.env. The bot token can be obtained through (SETTINGS -> Bot [-> Reset Token])
gs_service_account.json
in the root directoryGoogle Sheets Stuff
section of config.env
Mahjong Soul Stuff
section of config.env
Make an injustice_servers.json
in the root directory, with <server_name>: <server_ID>
pairs. The <server_name>
is for record-keeping only. Only servers whose <server_ID>
is specified here will have the /injustice
command available. Example:
{
"Longhorn Riichi": "111111111111111111",
"The Riichi Mahjong Association (UT Dallas)": "111111111111111111",
"Riichi Nomi": "111111111111111111"
}
Similarly, make a slash_commands_servers.json
in the root directory, for the servers that want the slash commands that are not exclusive to Longhorn Riichi (excluding /injustice
).
{
"Longhorn Riichi": "111111111111111111",
"The Riichi Mahjong Association (UT Dallas)": "111111111111111111",
"Main Mahjong Server": "111111111111111111",
"Riichi Nomi": "111111111111111111"
}
in a Unix shell:
pipenv install
pipenv shell
./start.sh
rh/sync
to sync the slash commands for that server (rh/
is the regular command prefix).mahjongsoul
module into the mjsoul.py
package)