This comes with:
* The RoleTags class
* Role.is_premium_subscriber()
* Role.is_bot_managed()
* Role.is_integration()
* Guild.self_role
* Guild.premium_subscriber_role
At readthedocs.io, for role `color`, it says "Returns the role colour. An alias exists under `color`". This PR fixes that to say "Returns the role color. An alias exists under `colour`".
This should have some memory savings of ~24 bytes per role.
* 8 bytes for Permissions
* 8 bytes for Colour
* 8 bytes for the alias
I'm not sure how significant it is but it should be a decent amount.
Introduce a new internal type, SnowflakeList, which has better memory
footprint over a regular list or set of roles. It is suspected that
there will be a 9x reduction of memory for every Emoji instance and a
48 byte saving per Member instance. However, these savings will
probably only be evident on larger bots.
As a consequence of this change, Member.roles is now computed lazily.
Currently I am not sure if I want to do the initial sorting on the
SnowflakeList for Member, as this comes with a O(n log n) cost when
creating a Member for little purpose since SnowflakeList.has is not
overly relied on. If CPU time becomes an issue this might change.
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.
A lot of the expensive getters were transformed into cached properties
instead. A lot of things that were properties were transformed into
properties as well.