Skip to content

feat: add Discord role permission sync module - #62

Open
koji-assistant[bot] wants to merge 1 commit into
mainfrom
feature/discord-role-permission-sync
Open

koji-assistant[bot] wants to merge 1 commit into
mainfrom
feature/discord-role-permission-sync

Conversation

@koji-assistant

@koji-assistant koji-assistant Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds discord-role-permission-sync, a player-connected hook module for syncing Takaro role membership to game permission levels.
  • Defaults to the 7D2D reserved-slot/admin command shape: admin add {playerGameId} {permissionLevel}.
  • Supports role-to-level mappings, optional unmatched fallback, dry-run mode, and optional private player messaging for matched/unmatched players.

Discord source

  • Channel: Reserved slots and Takaro/Discord role integration
  • User: Trevor (trevorjd)
  • Source messages:
    • afaad216-748f-4b26-9157-a7da4c78011a at 2026-08-02T02:19:45.184Z: asked whether a module exists that sets a player's 7D2D permission level from their synced Takaro/Discord role for VIP reserved slots.
    • 2c61cf45-0857-4d35-8e28-e047fae96bc0 at 2026-08-02T02:39:27.853Z: sketched the desired on-join command behavior and optional Discord-link reminder.

Test evidence

  • npm run build ✅
  • npm run typecheck ✅
  • node --test modules/discord-role-permission-sync/test/helpers.test.js ✅ (6 helper tests)
  • node dist/scripts/module-to-json.js modules/discord-role-permission-sync /tmp/discord-role-permission-sync.json ✅
  • Import-parse probe for src/functions/permission-sync-helpers.js ✅

Runtime QA

  • Sandbox push/install was attempted but blocked by Takaro API login returning Cloudflare HTTP 522 twice from this cron environment.
  • Real 7D2D/player-connected verification is still needed before merge/publication: install the module, configure a role mapping such as Diamond -> 200, join as a mapped player, verify hook-executed success:true, and confirm the game console/serveradmin permission level changed.

Reviewer notes

  • This intentionally maps Takaro role names. If Discord role sync creates/assigns Takaro roles, configure those synced Takaro names in rolePermissionMappings.
  • dryRun: true is available for safe setup before executing admin add live.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants