aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-11-20 13:33:32 -0700
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-11-20 13:33:32 -0700
commit5d4be60821eda6c3a27abd9935827c570bfcc0f5 (patch)
treec371e89d8047c2c837900bdfbac0e377ae6b8c8d
parent7a6eeec2d0922dc54f8feee52ad22ec1d064cb9a (diff)
parent3748df9a58ff92b71980eda613d4ffe6aa8bda91 (diff)
downloadchessh-bot-main.tar.gz
chessh-bot-main.zip
Merge branch 'main' of github.com:Simponic/chessh_botHEADmain
-rw-r--r--src/api/index.ts9
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) {