Enhance error logging and update message handling in vordinace and vyhledavac modules
This commit is contained in:
parent
3c206c7f4b
commit
8ee056680b
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "denim_3001",
|
||||
"version": "3001.62.8",
|
||||
"version": "3001.62.9",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "denim_3001",
|
||||
"version": "3001.62.8",
|
||||
"version": "3001.62.9",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@discordjs/voice": "^0.19.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "denim_3001",
|
||||
"version": "3001.62.8",
|
||||
"version": "3001.62.9",
|
||||
"description": "Toto je velmi kvalitní bot.",
|
||||
"repository": {
|
||||
"url": "https://github.com/Histmy/Denim-Bot/"
|
||||
|
||||
@ -52,9 +52,9 @@ process.on("unhandledRejection", (reason, promise) => {
|
||||
process.on("uncaughtException", (err) => {
|
||||
log(new Error("Uncaught Exception in app:"), err);
|
||||
|
||||
let message: string | Error;
|
||||
let message: string;
|
||||
if (err instanceof Error) {
|
||||
message = err;
|
||||
message = `${err.name}: ${err.message}\n${err.stack}`;
|
||||
} else {
|
||||
message = String(err);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ import { emouty } from "../utils/emotes";
|
||||
|
||||
let client: CClient;
|
||||
|
||||
const logg = (...cokoli: any[]) => log("[OnePlayTest]: ", ...cokoli);
|
||||
const logg = (...cokoli: any[]) => log("[OnePlayDownloader]: ", ...cokoli);
|
||||
|
||||
const token = process.env.OnePlayToken;
|
||||
|
||||
@ -50,14 +50,18 @@ async function udelejOneplayRquest(cesta: string, body: string) {
|
||||
throw new Error("token more");
|
||||
}
|
||||
|
||||
let ok = false;
|
||||
const res = await betterFetch(`https://http.cms.jyxo.cz/api/v3/${cesta}`, {
|
||||
method: "POST",
|
||||
body,
|
||||
headers: { Authorization: token }
|
||||
}).then(res => res.json())
|
||||
}).then(res => {
|
||||
ok = res.ok;
|
||||
res.json();
|
||||
})
|
||||
.catch(e => { throw new Error(`chyba pri udelejoneplayrequest fetch ${e}`); });
|
||||
|
||||
logg("nejspis uspesna odpoved", res);
|
||||
logg(`nejspis ${ok ? "" : "ne"}uspesna odpoved`, res);
|
||||
}
|
||||
|
||||
const sleep = (time: number) => new Promise(res => setTimeout(res, time));
|
||||
@ -188,7 +192,7 @@ async function urobit() {
|
||||
if (!guilda) return log(new Error("dobytcarna nenalezena"));
|
||||
|
||||
const kdyToBude = new Date();
|
||||
kdyToBude.setHours(21);
|
||||
kdyToBude.setHours(20);
|
||||
kdyToBude.setSeconds(0);
|
||||
|
||||
let nazev = "";
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { APIEmbed, CommandInteractionOption, Message, TextBasedChannel } from "discord.js";
|
||||
import { CClient, Modul } from "../utils/types";
|
||||
import { bazenek, log, sendWithoutReply, strankovani } from "../utils/utils";
|
||||
import { bazenek, log, messageLinks, sendWithoutReply, strankovani } from "../utils/utils";
|
||||
|
||||
const zpracovatZpravu = (mes: Message) => new Promise<void>(async (res, rej) => {
|
||||
if ([6, 7, 8, 9, 10, 11, 18, 23, 46].includes(mes.type)) return res();
|
||||
@ -83,6 +83,7 @@ const exp: Modul = {
|
||||
}
|
||||
|
||||
const odpoved = await int.reply("hledam");
|
||||
messageLinks.set(odpoved.id, "<nic>"); // Hack, ale já na tohle už nechci šahat
|
||||
|
||||
const sql = `SELECT CONVERT(ID, CHAR) as idcko, SUBSTRING(Content, 1, 20) AS kontent FROM Zpravy WHERE ${parsedFiltry.join(" AND ")} ORDER BY ID ${seradit}`;
|
||||
bazenek.query({ sql, values: mista }, (err, res?: { idcko: string; kontent: string; }[]) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user