This commit is contained in:
Histmy 2023-08-21 23:12:12 +02:00
parent 1f02896670
commit 8fcc63d753

View File

@ -13,16 +13,15 @@ const pool = createPool({
});
const zpracovatZpravu = (mes: Message) => new Promise<void>(async (res, rej) => {
console.log("zpracovavam", mes.id);
if ([6, 7, 8, 9, 10, 11, 18, 23].includes(mes.type)) return res();
if (mes.type != 0 && mes.type != 20 && mes.type != 19) throw new Error("Neznámej message type " + mes.type.toString());
const reference = mes.reference?.messageId;
let attachments: { name: string; file: string; }[] = [];
const attachments: { name: string; file: string; }[] = [];
if (mes.attachments.size != 0) {
for (const [_, attachment] of mes.attachments) {
for (const [, attachment] of mes.attachments) {
attachments.push({ name: attachment.name, file: attachment.id });
}
}
@ -65,7 +64,6 @@ const exp: Modul = {
slashRun: async int => {
const moznosti = int.options;
const filtry = moznosti.data;
console.log(filtry);
if (!filtry.length) return "co takhle tam alespon jeden filtr";
// Nelgel kombinace a tak
@ -92,7 +90,6 @@ const exp: Modul = {
const odpoved = await int.reply("hledam");
const sql = `SELECT CONVERT(ID, CHAR) as idcko, SUBSTRING(Content, 1, 20) AS kontent FROM Zpravy WHERE ${parsedFiltry.join(" AND ")} ORDER BY ID ${seradit}`;
console.log(sql, mista);
pool.query({ sql, values: mista }, (err, res?: { idcko: string; kontent: string; }[]) => {
if (err) return odpoved.edit(`chyba: ${err}`);
@ -100,8 +97,6 @@ const exp: Modul = {
odpoved.edit("nasel sem tuto:");
console.log(res);
let celkovadylka = 0;
const stranky: string[][] = [[]];
let aktualniStranka = 0;
@ -147,12 +142,11 @@ const exp: Modul = {
while (true) {
const msgs = await (channel.messages.fetch(posledni ? { before: posledni } : undefined));
for (const [_, mes] of msgs) {
for (const [, mes] of msgs) {
try {
await zpracovatZpravu(mes);
} catch {
console.log("zkonciclii sme");
return;
}
}