From 7b565024db5e460158f43410361fe32f5c4f3d88 Mon Sep 17 00:00:00 2001 From: Histmy Date: Mon, 20 Feb 2023 21:34:09 +0100 Subject: [PATCH] =?UTF-8?q?nojo,=20te=C4=8F=20je=20ten=20k=C3=B3d=20mnohem?= =?UTF-8?q?=20lep=C4=8Dej=C5=A1=C3=AD=20a=20funk=C4=8Dn=C4=9Bj=C5=A1=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/sachy.ts | 6 +++--- src/utils/sachyEtc.ts | 1 - src/utils/sachyServer.ts | 8 +++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/modules/sachy.ts b/src/modules/sachy.ts index 7361dbd..3052437 100644 --- a/src/modules/sachy.ts +++ b/src/modules/sachy.ts @@ -94,7 +94,7 @@ function jeCheck(barva: Hra["hraje"], deska: Deska) { // od pawnů [7, 9].forEach(i => { - let pis = deska[index - i]; + const pis = deska[index - i]; if (pis?.typ == "pawn" && pis.barva != barva) check = true; }); @@ -255,7 +255,7 @@ function legalniTahy(index: number, deska: Deska) { tahy.splice(i, 1); i--; } - }; + } return tahy; } @@ -474,7 +474,7 @@ const exp: Modul = { for (const player of [mes.author.id, druhej]) { if (hraci[player]) return "zakaz symultanki"; - }; + } const message = await mes.channel.send("hraj zopiciva"); diff --git a/src/utils/sachyEtc.ts b/src/utils/sachyEtc.ts index 8e4c7b2..ecc95f2 100644 --- a/src/utils/sachyEtc.ts +++ b/src/utils/sachyEtc.ts @@ -1,4 +1,3 @@ -import { Message } from "discord.js"; import { SRecord } from "./types"; export const fokinLookupTable: SRecord = { diff --git a/src/utils/sachyServer.ts b/src/utils/sachyServer.ts index 8373ed7..03474d8 100644 --- a/src/utils/sachyServer.ts +++ b/src/utils/sachyServer.ts @@ -4,7 +4,7 @@ import { join } from "path"; import { readFileSync } from "fs"; import fetch from "node-fetch"; import { TypedEmitter } from "tiny-typed-emitter"; -import { log, rand } from "./utils"; +import { log } from "./utils"; const basePath = join(__dirname, "../../res/sachy"); const sessions: SRecord = {}; @@ -148,15 +148,17 @@ const server = createServer((req, res) => { if (req.url?.startsWith("/oauth")) return overeni(req.url, session, res); switch (url.pathname) { - case "/": + case "/": { const response = indexStranka.replace("$logged", session.logedIn ? "1" : "0") .replace("$jmeno", session.discordName ?? ""); return res.end(response); + } - case "/login": + case "/login": { const path = url.searchParams.get("redirect"); session.redirect = path || ""; return login(session, res); + } case "/logout": return logout(session, res);