Fixed the shop search feature

This commit is contained in:
ION606
2022-05-29 21:30:37 +03:00
parent 69a5a2e18d
commit 65f4de28ed
3 changed files with 7 additions and 9 deletions
+2 -3
View File
@@ -138,8 +138,7 @@ client.connect(err => {
]); ]);
}); });
client.close(); client.close().then(function() {
const END = d.getTime(); const END = d.getTime();
console.log(`Total time in SECONDS: ${(((END - START) % 60000) / 1000).toFixed(0)} ms!`); console.log(`Total time in SECONDS: ${(((END - START) % 60000) / 1000).toFixed(0)} ms!`);
});
+1 -1
View File
@@ -45,7 +45,7 @@ function attack(client, user_dbo, other_dbo, bot, thread, command, mongouri, ite
if (new_hp <= 0) { if (new_hp <= 0) {
winGame(client, bot, client.db(user_dbo.s.namespace.db), user_dbo, xp_collection, interaction.message); winGame(client, bot, client.db(user_dbo.s.namespace.db), user_dbo, xp_collection, interaction.message);
} else { } 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)
} }
}); });
+2 -3
View File
@@ -262,9 +262,8 @@ function getShop(message, args, items, bot) {
noinp = true; noinp = true;
} }
const items2 = items.slice((ind - 1)*10, (ind - 1)*10+10); 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}`) newText = Formatters.codeBlock(items2.map(i => `${i.icon} (${i.name}): \$${i.cost}`).join('\n'));
.filter(f => f.sect = args[0]).join('\n'));
if (noinp) { if (noinp) {
newText += `(Use ${bot.prefix}shop [type] [page number] to access other pages)`; newText += `(Use ${bot.prefix}shop [type] [page number] to access other pages)`;