From 65f4de28ed9f26adcb0dfc3c2494a8cb1c3764b6 Mon Sep 17 00:00:00 2001 From: ION606 Date: Sun, 29 May 2022 21:30:37 +0300 Subject: [PATCH] Fixed the shop search feature --- COMPLETE_INIT.js | 9 ++++----- commands/db/battle.js | 2 +- commands/db/econ.js | 5 ++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/COMPLETE_INIT.js b/COMPLETE_INIT.js index 23a81aa..aac5fd3 100644 --- a/COMPLETE_INIT.js +++ b/COMPLETE_INIT.js @@ -138,8 +138,7 @@ client.connect(err => { ]); }); -client.close(); - -const END = d.getTime(); - -console.log(`Total time in SECONDS: ${(((END - START) % 60000) / 1000).toFixed(0)} ms!`); \ No newline at end of file +client.close().then(function() { + const END = d.getTime(); + console.log(`Total time in SECONDS: ${(((END - START) % 60000) / 1000).toFixed(0)} ms!`); +}); \ No newline at end of file diff --git a/commands/db/battle.js b/commands/db/battle.js index bb80292..33c5ef3 100644 --- a/commands/db/battle.js +++ b/commands/db/battle.js @@ -45,7 +45,7 @@ function attack(client, user_dbo, other_dbo, bot, thread, command, mongouri, ite if (new_hp <= 0) { winGame(client, bot, client.db(user_dbo.s.namespace.db), user_dbo, xp_collection, interaction.message); } else { - other_dbo.updateOne({'equipped': {$exists: true}}, { $set: { hp :new_hp }}); //THIS DOES NOT WORK + other_dbo.updateOne({'equipped': {$exists: true}}, { $set: { hp :new_hp }}); //THIS DOES NOT WORK (OVERWRITES HPMP MAP WITH ONE VALUE) } }); diff --git a/commands/db/econ.js b/commands/db/econ.js index 729bd96..2c73dd5 100644 --- a/commands/db/econ.js +++ b/commands/db/econ.js @@ -262,9 +262,8 @@ function getShop(message, args, items, bot) { noinp = true; } - const items2 = items.slice((ind - 1)*10, (ind - 1)*10+10); - newText = Formatters.codeBlock(items2.map(i => `${i.icon} (${i.name}): \$${i.cost}`) - .filter(f => f.sect = args[0]).join('\n')); + const items2 = items.filter(function(f) { return (f.sect.toLowerCase() == args[0].toLowerCase()) }).slice((ind - 1)*10, (ind - 1)*10+10); + newText = Formatters.codeBlock(items2.map(i => `${i.icon} (${i.name}): \$${i.cost}`).join('\n')); if (noinp) { newText += `(Use ${bot.prefix}shop [type] [page number] to access other pages)`;