Skip to content

Commit

Permalink
Merge pull request #2 from TwoSails/methods
Browse files Browse the repository at this point in the history
Version 1.20
  • Loading branch information
xMicky24GIT authored Jul 10, 2020
2 parents 2faa230 + acfe03e commit 03ac43f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
21 changes: 20 additions & 1 deletion DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,24 @@ New in version 1.1.0

### player.get_raw_player()

Returns a raw json containing all the informations about the player.
Returns a raw json containing all the information about the player.
New in version 1.1.0

### player.get_rank()

Returns the player rank. Returns None if player hasn't rank.
New in version 1.2.0

### player.get_karma()

Returns the player karma.
New in version 1.2.0

### player.get_mc_version()

Returns the last version the player logged in to the sever.
New in version 1.2.0

---

## Guild methods
Expand Down Expand Up @@ -225,6 +240,10 @@ Returns a raw json with all the informations about the guild ([example](https://
Returns the guild exp.
New in version 1.1.0

### guild.get_created()

Returns date when the guild was created as an epoch time format.
New in version 1.2.0
---

## GameTypes
Expand Down
39 changes: 39 additions & 0 deletions hypixelapi/hypixelapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,18 @@ def get_name(self):
return self.raw_player['displayname']


def get_rank(self):
"""
Returns player's rank. Returns None if player hasn't rank
New in version 1.2.0
"""
if 'rank' in self.raw_player:
return self.raw_player['rank']

return None


def get_achievements(self):
"""
Returns a dict containing all the player achievements.
Expand Down Expand Up @@ -264,6 +276,24 @@ def get_level(self):
return floor(1 + REVERSE_PQ_PREFIX + sqrt(REVERSE_CONST + GROWTH_DIVIDES_2 * exp))


def get_karma(self):
"""
Returns the karma of the player.
New in version 1.2.0
"""
return self.raw_player['karma']


def get_mc_version(self):
"""
Returns the last version of minecraft the player logged in to the server.
New in version 1.2.0
"""
return self.raw_player['mcVersionRp']


def get_friends(self):
"""
Returns a dict containg a list of Player's friends.
Expand Down Expand Up @@ -436,6 +466,15 @@ def get_exp(self):
return self.raw_guild['exp']


def get_created(self):
"""
Returns date when the guild was created as an epoch time format
New in version 1.2.0
"""
return self.raw_guild['created']


def get_raw_guild(self):
"""
Returns raw json of the guild
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

setuptools.setup(
name="pyhypixel",
version="1.1.0",
version="1.2.0",
author="SonoMichele",
author_email="[email protected]",
description="An unofficial HypixelAPI wrapper",
Expand Down

0 comments on commit 03ac43f

Please sign in to comment.