From 3d03dbc45179f645b59838729047e896cc387049 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Mon, 24 Sep 2018 21:05:41 -0400 Subject: Change internal role storage in Guild to a dict instead of a list. This adds the following APIs: * Guild.get_role This removes the following APIs: * Guild.role_hierarchy To compensate for the removed APIs, Guild.roles is now a sorted list based on hierarchy. The first element will always be the @everyone role. This speeds up access at the cost of some memory, theoretically. --- docs/migrating.rst | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'docs') diff --git a/docs/migrating.rst b/docs/migrating.rst index 074cc2d6..3e9def24 100644 --- a/docs/migrating.rst +++ b/docs/migrating.rst @@ -368,11 +368,17 @@ They will be enumerated here. - Use :attr:`Member.activity` instead. +- ``Guild.role_hierarchy`` / ``Server.role_hierarchy`` + + - Use :attr:`Guild.roles` instead. Note that while sorted, it is in the opposite order + of what the old ``Guild.role_hierarchy`` used to be. + **Changed** - :attr:`Member.avatar_url` and :attr:`User.avatar_url` now return the default avatar if a custom one is not set. - :attr:`Message.embeds` is now a list of :class:`Embed` instead of ``dict`` objects. - :attr:`Message.attachments` is now a list of :class:`Attachment` instead of ``dict`` object. +- :attr:`Guild.roles` is now sorted through hierarchy. The first element is always the ``@everyone`` role. **Added** @@ -398,6 +404,7 @@ They will be enumerated here. - :attr:`Message.activity` and :attr:`Message.application` for Rich Presence related information. - :meth:`TextChannel.is_nsfw` to check if a text channel is NSFW. - :meth:`Colour.from_rgb` to construct a :class:`Colour` from RGB tuple. +- :meth:`Guild.get_role` to get a role by its ID. .. _migrating_1_0_sending_messages: -- cgit v1.2.3