diff --git a/package-lock.json b/package-lock.json index 676d9a0..26ff706 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "denim_3001", - "version": "3001.41.2", + "version": "3001.42.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "denim_3001", - "version": "3001.41.2", + "version": "3001.42.0", "license": "ISC", "dependencies": { "@discordjs/voice": "^0.11.0", diff --git a/package.json b/package.json index ad0c749..d3c44b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "denim_3001", - "version": "3001.41.2", + "version": "3001.42.0", "description": "Toto je velmi kvalitní bot.", "repository": { "url": "https://github.com/Histmy/Denim-Bot/" diff --git a/src/utils/customCommands.ts b/src/utils/customCommands.ts index ca54b04..ef156ac 100644 --- a/src/utils/customCommands.ts +++ b/src/utils/customCommands.ts @@ -4,6 +4,7 @@ import { readFileSync, writeFileSync } from "fs"; import { join } from "path"; import { oddiakritikovat } from "./utils"; +const ex = module.exports; const cesta = join(__dirname, "../../res/"); const customKomandi: SRecord<{ text: string; owner: string; }> = JSON.parse(readFileSync(`${cesta}komandi.json`).toString()); const customAliasy: SRecord<{ cmd: string; owner: string; }> = JSON.parse(readFileSync(`${cesta}aliasi.json`).toString()); @@ -42,7 +43,7 @@ export const naucse: RunFunkce = (mes, arg) => { if (args.length == 1) return "a co bich nato mnel rict????"; args[0] = oddiakritikovat(args[0].toLowerCase()); - if (module.exports.realKomandy[args[0]] || customKomandi[args[0]] || module.exports.realAliasy[args[0]] || customAliasy[args[0]]) return "tuten komand uz ale egzistuje"; + if (ex.realKomandy[args[0]] || customKomandi[args[0]] || ex.realAliasy[args[0]] || customAliasy[args[0]]) return "tuten komand uz ale egzistuje"; customKomandi[args[0]] = { text: args.splice(1).join(" "), owner: mes.author.id }; save(); @@ -52,7 +53,7 @@ export const naucse: RunFunkce = (mes, arg) => { export const zapomen: RunFunkce = (mes, arg) => { const com = oddiakritikovat(arg.toLowerCase()); - if (module.exports.realKomandy[com]) return "tuten komand se neda smazat ti smazko"; + if (ex.realKomandy[com]) return "tuten komand se neda smazat ti smazko"; const cmd = customKomandi[com]; if (!cmd) return `komand "${arg}" neznam`; if (cmd.owner != mes.author.id) return "tuto ael neni tvuj komand toxikale zkurvenej"; @@ -76,10 +77,15 @@ export const naucsealias: RunFunkce = (mes, arg) => { if (args.length == 0) return "a co se mam jako naucit"; if (args.length == 1) return "a co to ma znamenat????"; - if (module.exports.realKomandy[args[0]] || customKomandi[args[0]] || module.exports.realAliasy[args[0]] || customAliasy[args[0]]) return "tuto uz ale egzistuje"; - if (!module.exports.realKomandy[args[1]] && !module.exports.realAliasy[args[1]]) return `nejze "${arg}" neni realnej komand ani alias`; + if (ex.realKomandy[args[0]] || customKomandi[args[0]] || ex.realAliasy[args[0]] || customAliasy[args[0]]) return "tuto uz ale egzistuje"; + + let jmeno: string; + if (!ex.realKomandy[args[1]] && !ex.realAliasy[args[1]]) { + if (!customKomandi[args[1]] && !customAliasy[args[1]]) return `nejze "${args[1]}" neni realnej ani vlastni komand ani alias`; + jmeno = customKomandi[args[1]] ? args[1] : customAliasy[args[1]].cmd; + } + else jmeno = (ex.realKomandy[args[1]]) ? args[1] : ex.realAliasy[args[1]]; - const jmeno = (module.exports.realKomandy[args[1]]) ? args[1] : module.exports.realAliasy[args[1]]; customAliasy[args[0]] = { cmd: jmeno, owner: mes.author.id }; save(); return "jo"; @@ -88,7 +94,7 @@ export const naucsealias: RunFunkce = (mes, arg) => { export const zapomenalias: RunFunkce = (mes, arg) => { const al = oddiakritikovat(arg.toLowerCase()); - if (module.exports.realAliasy[al]) return "tutn alijas se ale neda smazat ty smazenice"; + if (ex.realAliasy[al]) return "tutn alijas se ale neda smazat ty smazenice"; const als = customAliasy[al]; if (!als) return `alijas "${al}" neznam`; if (als.owner != mes.author.id) return "tuto ael neni tvuj alijas toxikale zkurvenej";