Ren-chan is a Discord bot for riichi club management, using Google Sheets for data store. Ren-chan is based on Ronhorn, as an effort to:
- isolate the club management commands from the mahjong analysis commands (e.g.,
/injustice
) - eventually create an end-to-end club management bot with minimal setup
bot.py
: entry point of the Discord bot. Does the following:- imports
global_stuff.py
, which does the following:- load all the environment variabels from
config.env
- load all the environment variabels from
- set up the non-slash Discord commands
- set up command error handlers (both slash and non-slash)
- imports
/ext/
: Discord bot extensions (each extension is a suite of slash commands and their helper functions)Utilities
: various utilities, including recording in-person games, managing club membership, etc.
First, cp config.template.env config.env
.
- set up a bot account on Discord's developer portal (
New Application
).- (SETTINGS -> Bot) Privileged Gateway Intents:
SERVER MEMBERS INTENT
ANDMESSAGE 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:
- General Permissions: Manage Roles, Read Messages/View Channels
- Text Permissions: Send Messages, Create Public Threads, Send Messages in Threads, Manage Messages, Manage Threads, Use External Emojis
- Current Bot Invite URL
- 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 "Create Credentials" for a service account (no need to give it access to the project). Generate a JSON key for that service account and save it as
gs_service_account.json
in the root directory - make a suitable Google Spreadsheet (example)
- share the Spreadsheet with that service account.
- fill in the
Google Sheets Stuff
section of config.env
-
in a Unix shell:
pipenv install pipenv shell ./start.sh
-
in the relevant Discord server: run
rc/sync
to sync the slash commands for that server (rc/
is the regular command prefix).
- Ronhorn
- amae-koromo and amae-koromo-scripts
- Ronnie
- mjsoul.py (eventually we'll add our
mahjongsoul
module into themjsoul.py
package) - mahjong_soul_api