A Discord bot for Longhorn Riichi's special tournament "UTA vs UTD". Functions include /register
, /create_table
, /pause_own_game
, etc.
bot.py
: entry point of the Discord bot; has the regular commands and command error handling/ext/extensions
: list of all modules forbot.py
to load from/ext/
, one per line/modules/pymjsoul
: a copy of mjsoul.py that providesMajsoulChannel
, a class for interfacing with Mahjong Soul's API/modules/mahjongsoul
: contains a wrapper ofMajsoulChannel
for use in our bot (in/ext/extensions/UvUManager
)
First, cp config.template.env config.env
.
- set up a bot account on Discord's developer portal (
New Application
).- (SETTINGS -> Bot) Privileged Gateway Intents:
MESSAGE CONTENT INTENT
- (SETTINGS -> Bot) Privileged Gateway Intents:
- invite the bot to the respective servers. You can use the developer portal's OAuth2 URL Generator (SETTINGS -> OAuth2 -> URL Generator):
- Scopes: bot
- Bot Permissions: Send Messages, Manage Messages, Add Reactions
- fill in the
Discord Stuff
section of config.env. The bot token can be obtained through (SETTINGS -> Bot [-> Reset Token])
- set up a Google Cloud project. Enable Google Sheets API access, and make a service account. Generate a JSON key for that service account and save it as
gs_service_account.json
in ext/UvUManager/ - make a suitable Google Spreadsheet (example) and share the Spreadsheet with that service account.
- fill in the
Google Sheets Stuff
section of config.env
- fill in the
Mahjong Soul Stuff
section of config.env
-
in a Unix shell:
pipenv install pipenv shell ./start.sh
-
in the relevant Discord server: run
$sync
to sync the slash commands for that server.
- pings the server every 4 hours to see if a reconnection is necessary.
- every ping, requests to set the
finish_time
of the tournament to be 90 days from the current time. Note that thedeadline
still needs to be extended manually (this can't be automated because only the contest creator can extend the deadline).
- Riichi Nomi's Ronnie bot
- mjsoul.py
- ms_api: Mahjong Soul API in Python (this project originally relied on this API and then switched to mjsoul.py)