SmartBotBlack / nftpanda-bot

8 stars 7 forks source link

I have 2 things I want you to fix. #2

Open ghostprize opened 2 years ago

ghostprize commented 2 years ago

I have 2 things I want you to fix.

  1. When an error like in the picture occurs, the bot cannot continue working.
  2. Energy filling function, want you to check first if there is enough food in the bag or not before going to buy food. And buying food multiple times uses more cpu than buying food once if there are all heroes of the same type.

Please help fix the problem. panda

frankduque commented 2 years ago

To fix this you can use:

for (let i = 0; i < PAUSE_TASK; ++i) { let modalErro = document.querySelectorAll(".modal-error.open")[0]; if (modalErro) { await new Promise((res) => setTimeout(res, 10000)); location.reload(); } await new Promise((res) => setTimeout(res, 1000)); }

Instead of:

await new Promise((res) => setTimeout(res, PAUSE_BUTTON));

This will check if the error modal appears while it wait. If any kind of error happens it reloads the page.

frankduque commented 2 years ago

For the seccond error i'm rewriting the code to check what you have in the inventory, and if you don't have the food it will buy a certain amount of food for every panda of the same rarity.

For example if you don't have the uncommon food, and you have to buy it, the script will count how many pandas of the same rarity you have and multiply by a number you choose (as if you and to buy 5 foods per panda you will set it to 5) and buy all the food at once to save cpu.