Skip to content

[Mineflayer with Python] bot.modes is NoneType and can't read isOn #3638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
aeromechanic000 opened this issue Apr 15, 2025 · 1 comment
Open
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f

Comments

@aeromechanic000
Copy link

  • [v] The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 10.8.2
  • node: 18.20.5

Detailed description of a problem

When call bot.modes.isOn(), sometimes it raised an exception saying can't read isOn of NoneType.

Your current code

if bot.modes.isOn('cheat')  :
    ...

Expected behavior

I am not sure if it is normal for bot.modes to be None in some cases. If this is not a normal case, I think we should always be able to call bot.modes.isOn wihout checking if bot.modes is None.

BTW, bot.entity and player.entity sometimes returns None as well, I believe these behaviors are not expected.

@aeromechanic000 aeromechanic000 added possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f labels Apr 15, 2025
@extremeheat
Copy link
Member

Can you show your full code? It's possible you're not waiting for the correct event before accessing parts of the bot. As mineflayer is event based, not all properties are available until after a specific event like spawn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f
Projects
None yet
Development

No branches or pull requests

2 participants