From 086180f4a94733c8df3034dc9f79ea987e786e24 Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Sun, 2 Jan 2022 01:03:30 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D1=81=D1=87=D1=91=D1=82=20=D0=BD?= =?UTF-8?q?=D0=B0=D0=B3=D1=80=D0=B0=D0=B4=D1=8B=20=D0=B2=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D1=81=D0=B8=D0=BC=D0=BE=D1=81=D1=82=D0=B8=20=D0=BE?= =?UTF-8?q?=D1=82=20=D0=BA=D0=BE=D0=BB-=D0=B2=D0=B0=20=D1=83=D1=87=D0=B0?= =?UTF-8?q?=D1=81=D1=82=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/Fun/8ball.js | 2 +- commands/Fun/findwords.js | 16 ++++++++-------- commands/Fun/number.js | 28 ++++++++++++++++------------ 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/commands/Fun/8ball.js b/commands/Fun/8ball.js index a7cd9b37..ae8bbcce 100644 --- a/commands/Fun/8ball.js +++ b/commands/Fun/8ball.js @@ -19,7 +19,7 @@ class Eightball extends Command { async run(message, args) { if (!args[0] || !message.content.endsWith("?")) return message.error("fun/8ball:ERR_QUESTION"); - const answerN = this.client.functions.randomNum(1, 20); + const answerN = this.client.functions.randomNum(1, 19); const answer = message.translate(`fun/8ball:RESPONSE_${answerN + 1}`); message.channel.send(answer); diff --git a/commands/Fun/findwords.js b/commands/Fun/findwords.js index 0e18a788..3a760932 100644 --- a/commands/Fun/findwords.js +++ b/commands/Fun/findwords.js @@ -26,6 +26,7 @@ class FindWords extends Command { let lang = null; if (message.guild.data.language === "uk-UA") return lang = "ru-RU"; else lang = message.guild.data.language; + const wordList = require(`../../assets/json/words/${lang}.json`); // Init some utils variables @@ -105,7 +106,7 @@ class FindWords extends Command { id: user.id, guildID: message.guild.id }); - userdata.money = userdata.money + 150; + userdata.money = userdata.money + (150 * (participants.length * 0.5)); userdata.save(); }; }; @@ -116,15 +117,14 @@ class FindWords extends Command { async function getWinner(array) { return new Promise(function (resolve) { const counts = {}; - let compare = 0; - let mostFrequent; + let compare = 0, + mostFrequent; + for (let i = 0, len = array.length; i < len; i++) { const winner = array[i]; - if (!counts[winner]) { - counts[winner] = 1; - } else { - counts[winner] = counts[winner] + 1; - }; + if (!counts[winner]) counts[winner] = 1; + else counts[winner] = counts[winner] + 1; + if (counts[winner] > compare) { compare = counts[winner]; mostFrequent = array[i]; diff --git a/commands/Fun/number.js b/commands/Fun/number.js index 3e3b7d03..db5a9bd2 100644 --- a/commands/Fun/number.js +++ b/commands/Fun/number.js @@ -22,8 +22,8 @@ class Number extends Command { async run(message, args, data) { if (currentGames[message.guild.id]) return message.error("fun/number:GAME_RUNNING"); - const participants = []; - const number = Math.floor(Math.random() * 3000); + const participants = [], + number = Math.floor(Math.random() * 3000); await message.sendT("fun/number:GAME_START"); @@ -51,16 +51,20 @@ class Number extends Command { participantCount: participants.length, participants: participants.map(p => `<@${p}>`).join(", ") }); - message.sendT("fun/number:WON", { - winner: msg.author.toString() - }); - const userdata = await this.client.findOrCreateMember({ - id: msg.author.id, - guildID: message.guild.id - }); - userdata.money = userdata.money + 100; - userdata.save(); - collector.stop(msg.author.username); + + if (participants.length > 1 && data.guild.disabledCategories && !data.guild.disabledCategories.includes("Economy")) { + message.sendT("fun/number:WON", { + winner: msg.author.username + }); + + const userdata = await this.client.findOrCreateMember({ + id: msg.author.id, + guildID: message.guild.id + }); + userdata.money = userdata.money + (100 * (participants.length * 0.5)); + userdata.save(); + collector.stop(msg.author.username); + }; }; if (parseInt(msg.content) < number) message.error("fun/number:BIG", { user: msg.author.toString(),