feat(tally): fix live VC status updates and add permission pre-flight check
- Move tally hook from process_session (per-guild, gated by Logs subs) to process_ws_replays (once per game, all guilds) via on_game_finished - Add set_voice_channel_status permission check at /tally-claim time so failures are immediate and visible rather than silent on every game - Remove entitlement gate from tally_claim and tally_transfer - Add VC tally permission section to /diagnose-perms when run in a VC - Add 5 new locale keys to en.json for the permission messages Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+13
-8
@@ -534,6 +534,19 @@ async def process_ws_replays(replays: list[dict]):
|
||||
)
|
||||
local_data["scoreboard_context"] = scoreboard_context
|
||||
|
||||
# Notify all active tallies immediately after the game is saved.
|
||||
# Done here rather than inside process_session so it fires for all
|
||||
# guilds regardless of their Logs channel subscriptions.
|
||||
try:
|
||||
await tally.on_game_finished(
|
||||
local_data.get("teams", []),
|
||||
local_data.get("winning_team_squadron") or None,
|
||||
bool(local_data.get("draw", False)),
|
||||
hex_id,
|
||||
)
|
||||
except Exception as e:
|
||||
logging.error(f"[TALLY] on_game_finished failed for {hex_id}: {e}")
|
||||
|
||||
forwarded_replays.append(local_data)
|
||||
validated_games.append({
|
||||
"sessionIdHex": hex_id,
|
||||
@@ -1132,14 +1145,6 @@ async def process_session(
|
||||
else:
|
||||
new_wl = get_standings(squadrons_clean)
|
||||
|
||||
# Update any live voice-channel tallies for this guild against this game.
|
||||
try:
|
||||
await tally.on_session_processed(
|
||||
guild_id, teams, winner, is_draw, session_id
|
||||
)
|
||||
except Exception as e:
|
||||
logging.error(f"[TALLY] hook failed for session {session_id}: {e}")
|
||||
|
||||
# Scoreboard Build
|
||||
lock = _scoreboard_locks.setdefault(session_id, asyncio.Lock())
|
||||
async with lock:
|
||||
|
||||
Reference in New Issue
Block a user