From d3618b08eadabe39726803f23b4c29e544c1885e Mon Sep 17 00:00:00 2001 From: alemidev Date: Thu, 9 Dec 2021 12:40:42 +0100 Subject: [PATCH] added getter for client name --- treepuncher/treepuncher.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/treepuncher/treepuncher.py b/treepuncher/treepuncher.py index c22a54e..6850d9e 100644 --- a/treepuncher/treepuncher.py +++ b/treepuncher/treepuncher.py @@ -79,6 +79,14 @@ class Treepuncher(MinecraftClient): logging.getLogger('apscheduler.executors.default').setLevel(logging.WARNING) # So it's way less spammy self.scheduler.start(paused=True) + @property + def name(self) -> str: + if self.online_mode and self.token: + return self.token.profile.name + if not self.online_mode and self.username: + return self.username + raise ValueError("No token or username given") + async def start(self): for m in self.modules: await m.initialize(self)