Skip to content

Commit

Permalink
Move some lines of code (related to ouputting the online status) into…
Browse files Browse the repository at this point in the history
… `print_dict_report`. Also add hypixel to the project description sentence.
  • Loading branch information
johndoknjas committed Jun 2, 2024
1 parent 85e04e3 commit d8d7cfb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# hypickle

A script that outputs realtime stats for custom lists of friends you create.
A script that outputs realtime hypixel stats for custom lists of friends you create.

### Installation:

Expand Down
12 changes: 6 additions & 6 deletions hypickle/Player.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def get_stats_dict(self) -> dict[str, str | float | int]:
return {'uuid': self.uuid(), 'name': self.name(), 'fkdr': self.get_fkdr(),
'star': self.get_bw_star(), 'pit_rank': self.pit_rank_string()}

def print_dict_report(self, report: dict, extra_text: str = '') -> None:
def print_dict_report(self, report: dict, output_online_status: bool = False) -> None:
report = deepcopy(report)
assert all(isinstance(v, (str,float,int)) for v in report.values())
possible_keys = ('name', 'fkdr', 'star', 'pit_rank', 'uuid', 'time')
Expand Down Expand Up @@ -287,7 +287,10 @@ def print_dict_report(self, report: dict, extra_text: str = '') -> None:
time_friended = date_obj.strftime('%b ') + date_obj.strftime('%d/%y').lstrip('0')
print(f" friended {time_friended}".ljust(20), end='')
print(recent_game_msg, end='')
print(extra_text, end='')
if output_online_status:
if is_online := self.hypixel_object().isOnline((True,)*3):
Utils.speak(f"{self.name()} is online")
print(f"this arg player is {'online' if is_online else 'offline'}", end='')
if not just_uuids and (updated_json := self.hypixel_object().updated_json) is not None:
print(f" (updated player json obtained {updated_json[1].strftime('%I:%M:%S %p')})", end='')
print()
Expand Down Expand Up @@ -335,10 +338,7 @@ def iterate_over_friends_for_report(
if self._players_used_to_combine:
assert self.root_player()
for player in self._players_used_to_combine:
online_status = 'online' if player.hypixel_object().isOnline((True,)*3) else 'offline'
if online_status == 'online':
Utils.speak(f"{player.name()} is online")
player.print_dict_report(player.get_stats_dict(), f"this arg player is {online_status}")
player.print_dict_report(player.get_stats_dict(), True)
print()

report.setdefault('friends', [])
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version = "1.1.5"
authors = [
{ name="John Doknjas", email="jdoknjas@sfu.ca" },
]
description = "A script that outputs realtime stats for custom lists of friends you create."
description = "A script that outputs realtime hypixel stats for custom lists of friends you create."
keywords = ["hypickle", "hypixel", "pit", "bedwars", "friends", "stats", "api"]
dependencies = [
"requests",
Expand Down

0 comments on commit d8d7cfb

Please sign in to comment.