3001.30.1

added alias p:gn:
added command zruspgn
This commit is contained in:
Histmy 2021-11-07 22:47:19 +01:00
parent a36a030ff0
commit fab5e31645
3 changed files with 46 additions and 32 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "denim_3001", "name": "denim_3001",
"version": "3001.30.0", "version": "3001.30.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "denim_3001", "name": "denim_3001",
"version": "3001.30.0", "version": "3001.30.1",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@discordjs/opus": "github:discordjs/opus", "@discordjs/opus": "github:discordjs/opus",

View File

@ -1,6 +1,6 @@
{ {
"name": "denim_3001", "name": "denim_3001",
"version": "3001.30.0", "version": "3001.30.1",
"description": "Toto je velmi kvalitní bot.", "description": "Toto je velmi kvalitní bot.",
"repository": { "repository": {
"url": "https://github.com/Histmy/Denim-Bot/" "url": "https://github.com/Histmy/Denim-Bot/"

View File

@ -46,7 +46,7 @@ const exp: Modul = {
more_komandy: { more_komandy: {
spinkacek: { spinkacek: {
als: ["spink", "spoink", "spinkake", "spoinkacek", "gn", "<:spinkacek:761652251966046208>", "<:gn:887124590583746590>"], als: ["spink", "spoink", "spinkake", "spoinkacek", "gn", emouty.spinkacek, emouty.gn],
run: async (mes) => { run: async (mes) => {
if (mes.author.bot) return `až někdy${emouty.kapp}`; if (mes.author.bot) return `až někdy${emouty.kapp}`;
if (await handleSpink("spinkacek", mes.member!)) { if (await handleSpink("spinkacek", mes.member!)) {
@ -81,38 +81,41 @@ const exp: Modul = {
} }
}, },
pgn: (mes, kdy) => { pgn: {
if (mes.author.bot) return emouty.sjeta; als: [`p${emouty.gn}`],
run: (mes, kdy) => {
if (mes.author.bot) return emouty.sjeta;
const ted = new Date(); const ted = new Date();
const tedT = Number(ted); const tedT = Number(ted);
const spink = new Date(); const spink = new Date();
if (/^\d+$/.test(kdy) || !kdy) if (/^\d+$/.test(kdy) || !kdy)
spink.setTime(tedT + Number(kdy || 7200) * 1000); spink.setTime(tedT + Number(kdy || 7200) * 1000);
else { else {
const cojavim = /^((?<d>\d+)\. ?((?<mo>\d+)\.)? ?|(?<z>z([ií]|ej)tra) )?(?<h>\d+)(:(?<m>\d+)(:(?<s>\d+))?)? ?(?<p>am|pm)?$/.exec(kdy.toLowerCase()); const cojavim = /^((?<d>\d+)\. ?((?<mo>\d+)\.)? ?|(?<z>z([ií]|ej)tra) )?(?<h>\d+)(:(?<m>\d+)(:(?<s>\d+))?)? ?(?<p>am|pm)?$/.exec(kdy.toLowerCase());
if (!cojavim) return `cos to tam napsal ty kokote?`; if (!cojavim) return `cos to tam napsal ty kokote?`;
const g = cojavim.groups!; const g = cojavim.groups!;
if (g.d) spink.setDate(Number(g.d)); if (g.d) spink.setDate(Number(g.d));
if (g.z) spink.setDate(ted.getDate() + 1); if (g.z) spink.setDate(ted.getDate() + 1);
if (g.mo) spink.setMonth(Number(g.mo) - 1); if (g.mo) spink.setMonth(Number(g.mo) - 1);
const h = Number(g.h); const h = Number(g.h);
spink.setHours(g.p == "pm" && h < 12 ? h + 12 : h); spink.setHours(g.p == "pm" && h < 12 ? h + 12 : h);
spink.setMinutes(Number(g.m) || 0); spink.setMinutes(Number(g.m) || 0);
spink.setSeconds(Number(g.s) || 0); spink.setSeconds(Number(g.s) || 0);
if (Number(spink) < tedT) return "to uz bylo ty magore"; if (Number(spink) < tedT) return "to uz bylo ty magore";
}
const uzPgn = budouciSpinky[mes.author.id];
if (uzPgn) {
clearTimeout(uzPgn);
delete budouciSpinky[mes.author.id];
}
budouciSpinky[mes.author.id] = setTimeout(() => handleSpink("spinkacek", mes.member!), Number(spink) - tedT);
return `tvuj spinkacek byl naplanovan na ${formatter(spink)}`;
} }
const uzPgn = budouciSpinky[mes.author.id];
if (uzPgn) {
clearTimeout(uzPgn);
delete budouciSpinky[mes.author.id];
}
budouciSpinky[mes.author.id] = setTimeout(() => handleSpink("spinkacek", mes.member!), Number(spink) - tedT);
return `tvuj spinkacek byl naplanovan na ${formatter(spink)}`;
}, },
ps: { ps: {
@ -126,6 +129,17 @@ const exp: Modul = {
const cas = Number(new Date()) - Number(new Date(tajmUp)); const cas = Number(new Date()) - Number(new Date(tajmUp));
return `uz ${f ? "je" : "jsi"} vzhuru ${formatCas(cas / 1000)}`; return `uz ${f ? "je" : "jsi"} vzhuru ${formatCas(cas / 1000)}`;
} }
},
zruspgn: {
als: ["zpgn", "cancelpgn", "cpgn", "unpgn", `unp${emouty.gn}`],
run: (mes) => {
const jehoSpink = budouciSpinky[mes.author.id];
if (!jehoSpink) return `spinkacek ale nemas naplanovanej ty kkte ${mes.author}`;
clearTimeout(jehoSpink);
delete budouciSpinky[mes.author.id];
return "to bylo teda trapny debile";
}
} }
}, },