Discord slash-command dice bot for TRPG play. The current codebase is split into:
contracts/for gateway/app-server request, response, and catalog DTOscore/for domain, use cases, presenters, text registry, sheet access, and SQLite infrastructureapp-server/for internal HTTP APIs and command executiongateway/for Discord Gateway connectivity, slash command sync, and command proxying
The bot uses Discord slash commands, not a legacy ! prefix.
/rhelpshows the full command list/rhelp <command>shows detailed help for one command/r,/ra,/rd,/rl,/rt,/rwhandle general dice and aliases/ruse,/rr,/rstat,/rdel,/rccchandle CoC sheet registration and rolls/rdndgenerates DnD ability scores
Localized command/help text is loaded from resource files such as
src/main/resources/command-text/ko_kr.yml.
Required:
- Discord bot token:
-Ddicebot.token=...DICEBOT_TOKEN
Google Sheets credentials:
-Ddicebot.google.credentials=/path/to/google-service-account.jsonDICEBOT_GOOGLE_CREDENTIALS=/path/to/google-service-account.json
The Google service-account credential path must be configured explicitly. The runtime does not auto-discover credential files by name.
Optional runtime settings:
- app-server base URL for the gateway:
-Ddicebot.app-server.base-url=http://127.0.0.1:8080DICEBOT_APP_SERVER_BASE_URL=http://127.0.0.1:8080
- app-server port:
-Ddicebot.app-server.port=8080DICEBOT_APP_SERVER_PORT=8080
- shard count:
-Ddicebot.shards=...DICEBOT_SHARDS
- SQLite path:
-Ddicebot.sqlite.path=...DICEBOT_SQLITE_PATH
- command text locale:
-Ddicebot.command-text.locale=ko_krDICEBOT_COMMAND_TEXT_LOCALE=ko_kr
- command executor settings:
-Ddicebot.command.parallelism=...DICEBOT_COMMAND_PARALLELISM-Ddicebot.command.queue-capacity=...DICEBOT_COMMAND_QUEUE_CAPACITY
- sheet hot cache size:
-Ddicebot.sheet.hot-cache-size=...DICEBOT_SHEET_HOT_CACHE_SIZE
- environment label for logs and telemetry:
-Ddicebot.environment=productionDICEBOT_ENVIRONMENT=production
- gateway New Relic health publishing:
-Ddicebot.health.publish.enabled=trueDICEBOT_HEALTH_PUBLISH_ENABLED=trueDICEBOT_APP_READY_URL=http://127.0.0.1:8080/internal/v1/health/readyDICEBOT_HEALTH_PUBLISH_INTERVAL_SECONDS=60DICEBOT_HEALTH_PUBLISH_TIMEOUT_SECONDS=2DICEBOT_HEALTH_EVENT_TYPE=DicebotHealthCheck
New Relic is optional. If the Java agent is attached with JAVA_TOOL_OPTIONS=-javaagent:/path/to/newrelic.jar, the gateway can publish DicebotHealthCheck custom events for app-server readiness and shard health. The deployment workflow can install and verify the Java agent when DICEBOT_NEW_RELIC_ENABLED=true; without the agent, the New Relic API calls are no-ops.
Use separate DICEBOT_ENVIRONMENT, NEW_RELIC_APP_NAME, NEW_RELIC_LABELS, and component-specific NEW_RELIC_LOG_FILE_NAME values for production and staging. For example, keep dicebot-gateway-production and dicebot-gateway-staging as separate New Relic applications, and filter health alerts by environment.
bash ./gradlew test
bash ./gradlew buildAfter building, start the app-server first and then the gateway:
java -Ddicebot.sqlite.path=.local/state/dicebot.db -Ddicebot.google.credentials=.local/credentials/google-service-account.json -jar app-server/build/libs/app-server-<version>.jar
java -Ddicebot.token=... -Ddicebot.app-server.base-url=http://127.0.0.1:8080 -jar gateway/build/libs/gateway-<version>.jarDeployment files and public troubleshooting notes live under deploy/.
CoC sheet registration currently accepts these URL styles:
.../edit#gid=2107011865.../edit?gid=2107011865#gid=2107011865.../edit?gid=2107011865
If a URL does not include gid, the slash command can fall back to an explicit sheet tab name.