diff options
| author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-11-20 13:33:32 -0700 |
|---|---|---|
| committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-11-20 13:33:32 -0700 |
| commit | 5d4be60821eda6c3a27abd9935827c570bfcc0f5 (patch) | |
| tree | c371e89d8047c2c837900bdfbac0e377ae6b8c8d /src/api/index.ts | |
| parent | 7a6eeec2d0922dc54f8feee52ad22ec1d064cb9a (diff) | |
| parent | 3748df9a58ff92b71980eda613d4ffe6aa8bda91 (diff) | |
| download | chessh-bot-5d4be60821eda6c3a27abd9935827c570bfcc0f5.tar.gz chessh-bot-5d4be60821eda6c3a27abd9935827c570bfcc0f5.zip | |
Diffstat (limited to 'src/api/index.ts')
| -rw-r--r-- | src/api/index.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/api/index.ts b/src/api/index.ts index 39f5b40..c55bb21 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -10,7 +10,7 @@ import { aiMove } from 'js-chess-engine'; const router = express.Router(); const chesshMovePath = (gameId: number) => - (process.env.CHESSH_MOVE_PATH as unknown as string).replace( + process.env.CHESSH_MOVE_PATH!.replace( ':gameId', gameId.toString(), ); @@ -18,9 +18,12 @@ const chesshMovePath = (gameId: number) => const sendNextMove = (gameId: number, move: string): Promise<BotMoveResponse> => axios .post(chesshMovePath(gameId), { - token: process.env.BOT_TOKEN as unknown as string, attempted_move: move.toLowerCase(), - } as BotMoveAttempt) + } as BotMoveAttempt, { + headers: { + "authorization": process.env.BOT_TOKEN! + } + }) .then((r): BotMoveResponse => { const body = r.data as BotMoveResponse; if (r.status === 200) { |
