diff --git a/package-lock.json b/package-lock.json index ef8733a..b71c7e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "denim_3001", - "version": "3001.58.1", + "version": "3001.58.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "denim_3001", - "version": "3001.58.1", + "version": "3001.58.2", "license": "ISC", "dependencies": { "@discordjs/voice": "^0.16.1", diff --git a/package.json b/package.json index 94ecbcc..e405804 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "denim_3001", - "version": "3001.58.1", + "version": "3001.58.2", "description": "Toto je velmi kvalitní bot.", "repository": { "url": "https://github.com/Histmy/Denim-Bot/" diff --git a/src/app.ts b/src/app.ts index 6ce486d..3d97b09 100644 --- a/src/app.ts +++ b/src/app.ts @@ -228,26 +228,32 @@ function handle(e: unknown, mesOrInt: Message | CommandInteraction) { mesOrInt.reply(txt); } -async function runKomand(mes: Message, cmd: Komand, cmdName: string, arg: string): Promise; -async function runKomand(interaction: CommandInteraction, cmd: Komand, cmdName: string): Promise; +async function runKomand(mes: Message, cmd: Komand, cmdName: string, arg: string): Promise; +async function runKomand(interaction: CommandInteraction, cmd: Komand, cmdName: string): Promise; async function runKomand(mesOrInt: Message | CommandInteraction, cmd: Komand, cmdName: string, arg?: string) { const jeMes = mesOrInt instanceof Message; + if (jeMes && cmd.slashRun) { + const nazev = `${prefix}${cmdName}`; + const id = client.slashCommandy[nazev]; + return void mesOrInt.channel.send(`tuto ejenom sleh komand `); + } + if (cmd.cd && jeMes) { const zbyva = Math.round(maKuldan(mesOrInt.author.id, cmdName, cmd.cd)); - if (zbyva) return void mesOrInt.channel.send(`si kkt vole maz kuldan jeste ${formatCas(zbyva)}`); + if (zbyva) return mesOrInt.channel.send(`si kkt vole maz kuldan jeste ${formatCas(zbyva)}`); } if (cmd.premium && !lidiCoMajDenimPremium.includes((mesOrInt instanceof Message) ? mesOrInt.author.id : mesOrInt.member?.user.id || "")) { - return void mesOrInt.channel?.send("sorka bracho tuto je koamnd jenom pro curaki co platy"); + return mesOrInt.channel?.send("sorka bracho tuto je koamnd jenom pro curaki co platy"); } const akce = cmd.run ?? cmd.slashRun!; if (typeof akce == "string") { const res = renderMessage(akce, arg?.split(" ") || []); - if (mesOrInt instanceof Message) return void mesOrInt.channel.send(res); - return void mesOrInt.reply(res); + if (mesOrInt instanceof Message) return mesOrInt.channel.send(res); + return mesOrInt.reply(res); } try { @@ -255,7 +261,7 @@ async function runKomand(mesOrInt: Message | CommandInteraction, cmd: Komand, cm const result = await akce(mesOrInt as never, arg || ""); if (!result) return; - if (jeMes) return void mesOrInt.channel.send(result) + if (jeMes) return mesOrInt.channel.send(result) .catch(e => handle(e, mesOrInt)); // další feklo mesOrInt.reply(result as InteractionReplyOptions); @@ -289,13 +295,6 @@ client.on("messageCreate", async mes => { const komand = client.komandy[cmdName]; if (mes.channel.type == ChannelType.DM && komand?.DMUnsafe) return void mes.channel.send("tuten komand bohuzel v sz nefunkuje"); - if (komand.slashRun) { - const nazev = `${prefix}${cmdName}`; - const id = client.slashCommandy[nazev]; - return void mes.channel.send(`tuto ejenom sleh komand `); - } - - if (komand) return void runKomand(mes, komand, cmdName, celArgs); // neměl jsi na mysli?