Skip to content

Ren-chan is a bot for managing Riichi Mahjong clubs. It supports score tracking, membership management, and more.

License

Notifications You must be signed in to change notification settings

peter1357908/Ren-chan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

  • bot.py: entry point of the Discord bot. Does the following:
    1. imports global_stuff.py, which does the following:
      1. load all the environment variabels from config.env
    2. set up the non-slash Discord commands
    3. set up command error handlers (both slash and non-slash)
  • /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.

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

  1. 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
  2. make a suitable Google Spreadsheet (example)
  3. share the Spreadsheet with that service account.
  4. 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)

About

Ren-chan is a bot for managing Riichi Mahjong clubs. It supports score tracking, membership management, and more.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published