Added "kdysemselspat" command
This commit is contained in:
parent
180910b4f1
commit
a2b5a9818b
@ -37,7 +37,7 @@ const ifUzRemove = (id: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function getLastEntry(id: string) {
|
async function getLastEntry(id: string) {
|
||||||
const odpoved = await safeQuery<{ spinkacek: string; vstavacek: string | undefined; }>(`SELECT spinkacek, vstavacek FROM spinkacky WHERE discord_id = ? ORDER BY spinkacek DESC LIMIT 1; `, [id]);
|
const odpoved = await safeQuery<{ spinkacek: Date; vstavacek: Date | undefined; }>(`SELECT spinkacek, vstavacek FROM spinkacky WHERE discord_id = ? ORDER BY spinkacek DESC LIMIT 1; `, [id]);
|
||||||
|
|
||||||
if (odpoved.err || !odpoved.data.length) return false;
|
if (odpoved.err || !odpoved.data.length) return false;
|
||||||
return odpoved.data[0];
|
return odpoved.data[0];
|
||||||
@ -58,7 +58,7 @@ const sendGmMessage = async (user: User, rictCas?: boolean) => {
|
|||||||
const zacatek = `dobry rano hajzle ${user}`;
|
const zacatek = `dobry rano hajzle ${user}`;
|
||||||
if (!rictCas || zapis === false) return zacatek;
|
if (!rictCas || zapis === false) return zacatek;
|
||||||
|
|
||||||
const cas = (Number(new Date(zapis.vstavacek ?? Date.now())) - Number(new Date(zapis.spinkacek))) / 1000;
|
const cas = (Number(zapis.vstavacek ?? Date.now()) - Number(zapis.spinkacek)) / 1000;
|
||||||
const formatedCas = formatCas(cas);
|
const formatedCas = formatCas(cas);
|
||||||
|
|
||||||
let zpr = "";
|
let zpr = "";
|
||||||
@ -239,7 +239,7 @@ const exp: Modul = {
|
|||||||
if (entry === false) return `tuten kkt jeste nespal ${emouty.lukiw}`;
|
if (entry === false) return `tuten kkt jeste nespal ${emouty.lukiw}`;
|
||||||
|
|
||||||
if (!entry.vstavacek) return "ten kkt jiz ickon spi";
|
if (!entry.vstavacek) return "ten kkt jiz ickon spi";
|
||||||
const cas = Number(new Date()) - Number(new Date(entry.vstavacek));
|
const cas = Date.now() - Number(entry.vstavacek);
|
||||||
return `uz ${prazdno ? "jsi" : "je"} vzhuru ${formatCas(cas / 1000)}`;
|
return `uz ${prazdno ? "jsi" : "je"} vzhuru ${formatCas(cas / 1000)}`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -259,6 +259,13 @@ const exp: Modul = {
|
|||||||
als: ["🚗🚗spink"],
|
als: ["🚗🚗spink"],
|
||||||
run: mes =>
|
run: mes =>
|
||||||
`autoautospink je ${autoSpinky[mes.author.id] ? (delete autoSpinky[mes.author.id], "vypnut") : (autoSpinky[mes.author.id] = [false, mes.channel], "zapnut")}`
|
`autoautospink je ${autoSpinky[mes.author.id] ? (delete autoSpinky[mes.author.id], "vypnut") : (autoSpinky[mes.author.id] = [false, mes.channel], "zapnut")}`
|
||||||
|
},
|
||||||
|
|
||||||
|
kdysemselspat: async mes => {
|
||||||
|
const entry = await getLastEntry(mes.author.id);
|
||||||
|
if (entry === false) return "este sy nigdy nespal";
|
||||||
|
|
||||||
|
return `to bilo ${formatter(entry.spinkacek)}`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user