Skip to content

Commit

Permalink
0.0.29
Browse files Browse the repository at this point in the history
  • Loading branch information
SilkePilon committed Nov 17, 2023
1 parent 1013adc commit b5cea83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions lodestone/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ def __init__(

self.mineflayer = require('mineflayer')
self.pathfinder = require('mineflayer-pathfinder')
self.goals = require('mineflayer-pathfinder').goals
if not self.disable_viewer:
self.mineflayer_viewer = require('prismarine-viewer').mineflayer
self.python_command = self.__check_python_command()
Expand Down Expand Up @@ -430,15 +429,21 @@ def log(self, message, icon="🤖", error=False, info=False, warning=False, chat
logger.info(f"[{icon}] {message}")
else:
logger.info(f"[{icon}] {message}")


def __wait_for_msa(self):
@self.once('login')
def await_login(*args):
logger.info("Logged in successfully!")

def __msa(self, *msa):
with self.console.status("[bold]Waiting for login...\n") as login_status:
self.msa_data = msa[0]
self.msa_status = True
self.log(message="It seems you are not logged in! Open your terminal for more information.", error=True,
console=False)
msg = str(self.msa_data['message']).replace("\n", "")
logger.error(f"It seems you are not logged in, {msg}")
self.__setup_events()
logger.error(f"It seems you are not logged in. {msg}")
self.__wait_for_msa()
if self.api_mode:
self.bot.end()
quit()
Expand Down Expand Up @@ -503,11 +508,11 @@ def __create_bot(self):
'defaultChatPatterns': self.local_default_chat_patterns
})
self.bot = local_bot

return local_bot


def __start(self):
self.__setup_events()
while not self.logged_in:
time.sleep(1)
self.log(
Expand Down Expand Up @@ -707,7 +712,6 @@ def __load_plugins(self):
def __setup_events(self):
@self.once("login")
def on_login(*_):
logger.info("Logged in successfully!")
self.logged_in = True
self.log(f"Connected to {self.local_host}", info=True)
self.log(f'Logged in as {self.bot.username}', info=True)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "lodestone"
version = "0.0.28"
version = "0.0.29"
description = "🤖 Create Minecraft bots with a powerful, stable, and high level Python API."
authors = [
{ name = "Silke Pilon", email = "[email protected]" },
Expand Down

0 comments on commit b5cea83

Please sign in to comment.