From e3c823f221b7658afa012060727296bdc37a32fe Mon Sep 17 00:00:00 2001 From: pe5ha Date: Wed, 17 May 2023 15:48:27 +0300 Subject: [PATCH] and again... --- src/GoogleTables.ts | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/GoogleTables.ts b/src/GoogleTables.ts index 7a2cedbca..e9f30cbbc 100644 --- a/src/GoogleTables.ts +++ b/src/GoogleTables.ts @@ -5,10 +5,10 @@ import fetch from 'node-fetch'; // sending notice about player turns via telegram bot export function sendTurnNotice(player: Player) { if (!player.telegramID) return; - let content = { + const content = { gameId: player.game.id, chat_id: player.telegramID, - type: 'TURN' + type: 'TURN', }; sendGASrequest(content); } @@ -16,10 +16,10 @@ export function sendTurnNotice(player: Player) { // sending notice about player turns via telegram bot export function deleteTurnNotice(player: Player) { if (!player.telegramID) return; - let content = { + const content = { gameId: player.game.id, chat_id: player.telegramID, - type: 'TURN_COMPLETE' + type: 'TURN_COMPLETE', }; sendGASrequest(content); } @@ -29,34 +29,34 @@ export function sendNoticeGameStart(player: Player) { if (!player.telegramID) return; const notice = ', new game start! 🚀 Your link: '+process.env.HOST+'/player?id='+player.id; const text = player.name + notice; - let content = { + const content = { gameId: player.game.id, chat_id: player.telegramID, type: 'GAME_START', - text: text + text: text, }; sendGASrequest(content); } -export function sendGameResults(game: Game){ +export function sendGameResults(game: Game) { let text = ''; game.getPlayers().forEach((player)=>{ text+=player.getVictoryPoints().total+' '+player.name+'\n'; }); - let content = { - gameId: game.id, - playersNumber: game.getPlayers().length, - generation: game.generation, - gameOptions: game.gameOptions, - // scores: - type: 'GAME_END', - text: text + const content = { + gameId: game.id, + playersNumber: game.getPlayers().length, + generation: game.generation, + gameOptions: game.gameOptions, + // scores: + type: 'GAME_END', + text: text, }; sendGASrequest(content); } -function sendGASrequest(content: any){ - let scriptURL = 'https://script.google.com/macros/s/AKfycbxqMfEYwiwluWYhj74TRanCJL88hyhdAEbBARhIcTAPGzLCaENgz8LNuAD_S0Y8UQlWyg/exec'; +function sendGASrequest(content: any) { + const scriptURL = 'https://script.google.com/macros/s/AKfycbxqMfEYwiwluWYhj74TRanCJL88hyhdAEbBARhIcTAPGzLCaENgz8LNuAD_S0Y8UQlWyg/exec'; fetch(scriptURL, { method: 'POST', headers: { @@ -64,4 +64,4 @@ function sendGASrequest(content: any){ }, body: JSON.stringify(content) }); -} \ No newline at end of file +}