Closed ibrahim12651 closed 1 month ago
Error: Fishing cancelled due to calling bot.fish() again
As the error states your code has called bot.fish()
again before the bot finished fishing the first time.
Calling bot.activateItem()
does real in the rod but does not cancel the previous bot.fish()
.
let fishingInProgress = false;
let fishingTimeout = null;
let retryFishing = false;
bot.on('spawn', () => {
console.log('Bot dünyaya girdi!');
bot.chat('/register');
bot.chat('/login ');
setTimeout(() => {
bot.chat('/skyblock');
setTimeout(startFishing, 5000);
}, 2000);
});
function startFishing() {
if (fishingInProgress) {
console.log('Balık tutma işlemi zaten devam ediyor.');
return;
}
fishingInProgress = true;
retryFishing = false;
console.log('Olta atılıyor...');
bot.fish().then(() => {
console.log('Balık başarıyla yakalandı!');
fishingInProgress = false;
clearTimeout(fishingTimeout);
sendInventoryToDiscord();
setTimeout(startFishing, 5000);
}).catch((err) => {
console.error('Balık tutma sırasında hata oluştu:', err);
fishingInProgress = false;
clearTimeout(fishingTimeout);
if (!retryFishing) {
retryFishing = true;
setTimeout(startFishing, 5000);
}
});
Hello yes the code is working properly thank you!
it worked 5-6 times and then stopped, why did such a thing happen, is it related to the server, I wonder?
Did it give an error message or just stop with its line out/in?
Did it give an error message or just stop with its line out/in?
The system doesn't give an error, it holds 6 to 5 items and then releases them.
What's really the problem ?
\node_modules\mineflayer\lib\plugins\fishing.js:45 fishingTask.cancel(new Error('Fishing cancelled due to calling bot.fish() again')) ^
Error: Fishing cancelled due to calling bot.fish() again at EventEmitter.fish (C:\Users\Desktop\MFishBot\node_modules\mineflayer\lib\plugins\fishing.js:45:26) at Timeout.startFishing [as _onTimeout] (C:\Users\bekta\Desktop\MFishBot\index.js:55:7) at listOnTimeout (node:internal/timers:581:17) at process.processTimers (node:internal/timers:519:7)