Skip to content

Commit

Permalink
0.0.27
Browse files Browse the repository at this point in the history
  • Loading branch information
SilkePilon committed Nov 14, 2023
1 parent 748715e commit 3863c28
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
51 changes: 50 additions & 1 deletion lodestone/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,59 @@
import click
from lodestone import fastapi
import subprocess
import time
from rich.console import Console
import lodestone
@click.command(context_settings={"ignore_unknown_options": True})
@click.option("--console", "-c", default=False, is_flag=True, help="Force the app to use the console")
@click.option("--test", "-t", is_flag=True, help="Run version tests on Lodestone")
@click.argument('args', nargs=-1)
def run(console, args):
def run(console, test, args):

if test:
versions = ["auto", "1.20.1", "1.19", "1.18", "1.17", "1.16", "1.15", "1.14", "1.13", "1.11", "1.10", "1.9", "1.8"]

console = Console()

with console.status("[bold]Checking versions...\n") as status:
for version in versions:
failed = ""
status.update(f"Checking version {version}")

# Create bot with the current version
try:
bot = lodestone.createBot(
host='2b2t.org',
username='TestBot',
version=version,
checkTimeoutInterval=70,
ls_skip_checks=True,
hideErrors=False,
ls_debug_mode=True,
ls_disable_viewer=True
)
except:
failed = "failed ([bold red]❌[reset])"
print(f"Version {version} failed to connect")


# Check connection
if bot.tablist:
failed = "passed ([bold green]✔️[reset])"
status.update(f"Checking version {version} {failed}")
else:
failed = "failed ([bold red]❌[reset])"
print(f"Version {version} failed to connect")

# Stop bot
bot.stop()

# Add delay to avoid congestion
for i in range(0, 10):

status.update(f"{version} {failed} ({10 - i} until next version)")
time.sleep(1)

def check_python_command():
try:
subprocess.check_output(['python', '--version'])
Expand Down
Binary file modified lodestone/__pycache__/utils.cpython-311.pyc
Binary file not shown.
3 changes: 2 additions & 1 deletion lodestone/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,8 @@ def stop(self):
"""

self.bot.end()
self.bot.viewer.close()
if not self.disable_viewer:
self.bot.viewer.close()
self.log("Ended bot!", warning=True)
return

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.26"
version = "0.0.27"
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 3863c28

Please sign in to comment.