57 Commits

Author SHA1 Message Date
Anurag Singh
5769511779 allow passing color int to role.edit 2020-05-10 19:35:45 -04:00
Saurabh Chaturvedi
3faa9799e3 Fix documentation problem with color
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`".
2020-04-04 02:42:22 -04:00
Rapptz
6071607176 Bump copyright year to 2020
Closes #2510
2020-01-19 20:03:00 -05:00
Rapptz
5c0b127c96 Create Permissions and Colour objects when necessary in Role
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.
2019-08-27 18:34:40 -04:00
NCPlayz
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
NCPlayz
fb02191b80 Organise documentation 2019-03-19 08:24:42 -04:00
Dante Dam
9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05:00
Rapptz
77239e4f15 Fix NameError and duplicate insertion bug when moving roles. 2018-09-24 23:55:05 -04:00
Rapptz
95d8bb2e85 Change internal representation of roles in Member and Emoji.
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.
2018-09-24 22:19:42 -04:00
Rapptz
3d03dbc451 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.
2018-09-24 21:08:48 -04:00
Rapptz
12cb074316 Take the default role property into account when comparing roles. 2018-09-24 20:19:47 -04:00
Hornwitser
c8b49d37be [lint] Fix incorrect and inconsistent whitespace
Adjust whitespace to be consistent with the rest of the library.
2018-08-22 21:43:53 -04:00
Hornwitser
d58fc0ccee [lint] Remove unused imports
Left over from various refactoring and rewrites.
2018-08-22 21:43:50 -04:00
Rapptz
f25091efe1 Drop support for Python 3.4 and make minimum version 3.5.2. 2018-06-10 18:10:00 -04:00
Steve C
0e945915b7 Fixes various documentation errors/inconsistencies
Mostly dealing with permissions, also fixes Raw Events inclusion.
2018-05-18 20:25:54 -04:00
Tobotimus
3112e1c17e Add intersphinx 2018-01-06 17:23:59 -05:00
Rapptz
f4e01b3a92 Make supported operations stand out more than attributes. 2017-05-20 02:08:34 -04:00
Rapptz
f73eb087c9 Use describe instead of tables for supported operations. 2017-05-13 18:48:14 -04:00
Rapptz
dff6bcc745 Add support for audit log reasons.
Most routes now have a 'reason' keyword argument.
2017-05-07 03:08:06 -04:00
Rapptz
d24c2a09b6 Change some format usage to use %-formatting.
Minor speed increase when we're not doing excessive attribute
access or any type of formatting.
2017-05-04 06:04:55 -04:00
Rapptz
c30ab8a3e5 Fix NameError in Role.edit when moving roles. 2017-04-22 04:47:43 -04:00
Rapptz
fde35848f6 Make Role.members use a list comprehension. 2017-03-25 00:47:51 -04:00
Rapptz
96a43fa9e3 Fix NameError in Role.edit 2017-03-05 06:48:18 -05:00
Rapptz
aa59762c04 Remove extra space. 2017-02-28 17:39:59 -05:00
Rapptz
81baafa1e2 Change Role.is_everyone to Role.is_default. 2017-01-29 20:59:36 -05:00
Rapptz
e77012f4d9 Make all public is_ functions into methods instead of properties. 2017-01-29 20:53:17 -05:00
Rapptz
ff9f5749e1 Update copyright year to 2017. 2017-01-20 23:19:19 -05:00
Rapptz
f4cadaf0cc Fix bug with GuildChannel.edit and Role.edit with positions.
I did not update the HTTP code for these two methods.
2017-01-16 18:19:18 -05:00
Rapptz
7eb73cdc71 Add Role.members to get every member with a role. 2017-01-03 09:52:06 -05:00
Rapptz
dceba9d962 Add useful repr to all data classes. 2017-01-03 09:52:06 -05:00
Rapptz
a7a60e433b Make roles and guilds stateful. 2017-01-03 09:51:55 -05:00
Rapptz
d1d54a468a Rename Server to Guild everywhere. 2017-01-03 09:51:54 -05:00
Rapptz
45c729b167 Switch IDs to use int instead of str 2017-01-03 09:51:49 -05:00
Rapptz
044b0824e6 Begin working on the rewrite. 2017-01-03 09:51:47 -05:00
Rapptz
b7c90a5e3d Fix role comparisons.
Fixes #409
2016-12-02 01:28:54 -05:00
Rapptz
13f85b3292 Make Roles totally ordered.
This also fixes a bug with Member.top_role that chose the wrong role
should they have the same position.
2016-09-21 04:22:12 -04:00
Rapptz
b6492a4124 Clarify Role.position documentation. 2016-06-01 20:47:33 -04:00
Rapptz
5016f12079 Add Role.server attribute.
This breaks events that expected a server parameter for the role events.
2016-06-01 19:27:48 -04:00
Rapptz
196e9463f5 Add Role.mentionable attribute. 2016-04-29 19:29:29 -04:00
Rapptz
abb955fdaa Add Role.mention property 2016-04-29 07:24:32 -04:00
Khazhismel Kumykov
9f722731dd Fix typo in Role.created_at 2016-04-09 02:33:09 -04:00
Rapptz
2ef38107d8 Add missing created_at properties for other objects.
Such as Channel, PrivateChannel, Object and Role.
2016-03-25 18:30:42 -04:00
Rapptz
8974dffc4e Change internal update functions to have a leading underscore. 2016-01-11 14:44:13 -05:00
Rapptz
db4cc791dd Update license of files to 2016. 2016-01-04 22:28:29 -05:00
Rapptz
f1f0e169e4 Add __slots__ where appropriate to data classes. 2015-12-19 06:18:12 -05:00
Rapptz
51d91c2a82 Most data classes now support hashing. 2015-12-17 00:32:54 -05:00
Rapptz
de1c74a399 Make more things into properties.
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.
2015-12-16 22:03:16 -05:00
Rapptz
9137d92f67 All data classes now support !=, == and str(obj). 2015-12-13 22:53:48 -05:00
Rapptz
d3fac94e21 Fix bug where Role.is_everyone doesn't propagate in GUILD_ROLE_UPDATE. 2015-12-10 00:10:01 -05:00
Rapptz
17171aaa60 Switch to NumPy style documentation. 2015-12-04 23:43:31 -05:00