diff --git a/packages/server/src/bot/driver.ts b/packages/server/src/bot/driver.ts index 4e561b9..ddb1e8a 100644 --- a/packages/server/src/bot/driver.ts +++ b/packages/server/src/bot/driver.ts @@ -162,7 +162,8 @@ export class BotDriver { return { kind: 'done' }; } if (result.kind === 'announce') { - const text = result.announcements[0]!.text; + const rejection = result.announcements[0]!; + const text = rejection.text; if (text === 'wont_help' || text === 'illegal_move' || text === 'no_such_piece' || text === 'no_legal_moves') { // Attempted-move announcements are audience 'both'. The bot's @@ -172,7 +173,6 @@ export class BotDriver { // so removing the announcement is safe. The whole decision cycle // runs before ws.ts broadcasts, so this pop always happens before // any broadcast. - const rejection = result.announcements[0]!; const anns = this.game.announcements; if (anns[anns.length - 1] === rejection) anns.pop(); return {