diff options
| author | Rapptz <[email protected]> | 2016-09-21 03:53:51 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-09-21 04:22:13 -0400 |
| commit | 5e20b468c1bb313b30396e5d8c5179662cc704ff (patch) | |
| tree | 2621f1b070bb7153fbb2ca3049c437bd1c50380c | |
| parent | Make Roles totally ordered. (diff) | |
| download | discord.py-5e20b468c1bb313b30396e5d8c5179662cc704ff.tar.xz discord.py-5e20b468c1bb313b30396e5d8c5179662cc704ff.zip | |
Add Server.role_hierarchy to get the current role hierarchy.
| -rw-r--r-- | discord/server.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/discord/server.py b/discord/server.py index 6703a8fc..aeda793c 100644 --- a/discord/server.py +++ b/discord/server.py @@ -264,6 +264,15 @@ class Server(Hashable): """Returns the server's creation time in UTC.""" return utils.snowflake_time(self.id) + @property + def role_hierarchy(self): + """Returns the server's roles in the order of the hierarchy. + + The first element of this list will be the highest role in the + hierarchy. + """ + return sorted(self.roles, reverse=True) + def get_member_named(self, name): """Returns the first member found that matches the name provided. |