nojo, teď je ten kód mnohem lepčejší a funkčnější

This commit is contained in:
Histmy 2023-02-20 21:34:09 +01:00
parent bec2cb7016
commit 7b565024db
3 changed files with 8 additions and 7 deletions

View File

@ -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");

View File

@ -1,4 +1,3 @@
import { Message } from "discord.js";
import { SRecord } from "./types";
export const fokinLookupTable: SRecord<string> = {

View File

@ -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<Session> = {};
@ -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);