peter1357908 / Ren-chan

Ren-chan is a bot for managing Riichi Mahjong clubs. It supports score tracking, membership management, and more.
MIT License
0 stars 0 forks source link
club-management japanese-mahjong mahjong riichi

Ren-chan

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:

  1. isolate the club management commands from the mahjong analysis commands (e.g., /injustice)
  2. eventually create an end-to-end club management bot with minimal setup

Repository Structure:

Setting up the bot

First, cp config.template.env config.env.

Discord Stuff

  1. set up a bot account on Discord's developer portal (New Application).
    • (SETTINGS -> Bot) Privileged Gateway Intents: SERVER MEMBERS INTENT AND MESSAGE CONTENT INTENT
  2. 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
  3. fill in the Discord Stuff section of config.env. The bot token can be obtained through (SETTINGS -> Bot [-> Reset Token])

    Google Sheets Stuff

  4. 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
  5. make a suitable Google Spreadsheet (example)
  6. share the Spreadsheet with that service account.
  7. fill in the Google Sheets Stuff section of config.env

Running the bot

  1. in a Unix shell:

    pipenv install
    pipenv shell
    ./start.sh
  2. in the relevant Discord server: run rc/sync to sync the slash commands for that server (rc/ is the regular command prefix).

Relevant Links (References)