Rapptz
095f0ec2fc
Optimise some member and user related routines.
...
* Skip user update if possible
* Drop copy.copy in favour of manual copy
Credit to Hornwitser for these findings.
2018-09-24 22:50: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
BeatButton
a4d1599ce9
Change docstrings to raw-strings
2018-09-14 22:55:27 -04:00
Mitchell Ferree
6d57ddf11b
Correct Member.__hash__
...
Make Member.__hash__ just use whatever its User object's hash impl is.
2018-08-23 19:10:29 -06: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
Rapptz
f8f8f418f3
Split Game object to separate Activity subtypes for Rich Presences.
...
This is a massive breaking change.
* All references to "game" have been renamed to "activity"
* Activity objects contain a majority of the rich presence information
* Game and Streaming are subtypes for memory optimisation purposes for
the more common cases.
* Introduce a more specialised read-only type, Spotify, for the
official Spotify integration to make it easier to use.
2018-03-05 11:15:49 -05:00
Tobotimus
3112e1c17e
Add intersphinx
2018-01-06 17:23:59 -05:00
Rapptz
21fd94a449
Attempt to change how member functions are detected for Member objects
2017-09-04 20:03:50 -04:00
Rapptz
62df23633a
Sort roles by hierarchy instead of by ID.
...
Fixes #741
2017-08-29 16:24:04 -04:00
Ethan
7ee63a26f0
Fix docstring
2017-08-22 04:45:52 -04:00
Rapptz
84f38b166e
Add atomic keyword argument for member role editing operations.
...
This affects:
* Member.add_roles
* Member.remove_roles
This is the main attempt of fixing long standing bugs like #56 . Since
cache consistency is too hard to ask for due to eventual consistency
and this generally being one of the only main roadblocks that the
cache ruins, it's best to just implement it in terms of the atomic
endpoint instead.
Fixes #56
2017-08-21 10:40:33 -04:00
Rapptz
be1cffb7c3
Support for discord.Object in Member.remove_roles and Member.add_roles
2017-08-09 18:41:54 -04:00
Rapptz
723e392c95
Properly sort roles and discard everyone role in Member.colour.
2017-06-24 20:55:47 -04:00
Rapptz
f588876587
Use Python3Lexer instead of PythonLexer for pygments.
2017-05-22 07:21:23 -04:00
Rapptz
229c471106
More broken Channel references.
2017-05-20 08:48:04 -04:00
Rapptz
f4e01b3a92
Make supported operations stand out more than attributes.
2017-05-20 02:08:34 -04:00
Rapptz
8526995004
Minor speedup when doing comparisons.
...
Shred 2 getattr calls + 1 global lookup to 1 global lookup.
2017-05-18 05:15:06 -04:00
Rapptz
8e34a256a4
Fix User == Member comparisons.
2017-05-18 05:12:48 -04:00
Rapptz
f73eb087c9
Use describe instead of tables for supported operations.
2017-05-13 18:48:14 -04:00
Rapptz
b44bba6ee6
First pass at documentation reform.
2017-05-12 20:14:34 -04:00
Rapptz
5106feaf57
Allow comparison between User and Member instances again.
2017-05-10 19:32:25 -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
c54a6a927d
Implement audit logs.
2017-04-30 02:58:27 -04:00
Rapptz
1fc08bc5a2
Remove unused imports.
2017-04-18 04:22:35 -04:00
Rapptz
ead18e3948
Fix issue with members not copying correctly.
2017-03-05 07:48:15 -05:00
Rapptz
67912193ec
Forward keyword arguments in Member.ban
2017-02-21 08:38:33 -05:00
Rapptz
bfe2b4fc03
Fix Member.display_name to work.
2017-02-10 03:10:30 -05:00
Rapptz
a632bdd871
Fix Member.permissions_in passing in the wrong self parameter.
2017-01-31 04:53:54 -05:00
Rapptz
e77012f4d9
Make all public is_ functions into methods instead of properties.
2017-01-29 20:53:17 -05:00
Rapptz
554ae196d3
Add missing int casts in many different events in the state.
...
Also remove redundant role parsing in Member._update_roles.
2017-01-28 08:14:43 -05:00
Rapptz
ff9f5749e1
Update copyright year to 2017.
2017-01-20 23:19:19 -05:00
Rapptz
4c981ee631
Add support for relationships.
2017-01-20 19:28:43 -05:00
Rapptz
fa384f2114
Make ClientUser separate from a regular User.
...
This removes Client.edit_profile in favour of ClientUser.edit.
2017-01-19 19:37:11 -05:00
Rapptz
92dd519b1a
Remove _get_guild_id from Messageable ABC.
2017-01-14 19:22:26 -05:00
Rapptz
aae8b783e9
VoiceChannel.voice_members is now computed when needed.
2017-01-08 04:31:33 -05:00
Rapptz
c863d93f69
Fix bug that made member roles go missing.
2017-01-03 20:17:58 -05:00
Rapptz
7690455b21
Make User and Member messageable.
2017-01-03 09:52:12 -05:00
Rapptz
98b981848d
Move message creation to a factory method inside ConnectionState.
2017-01-03 09:52:10 -05:00
Rapptz
dceba9d962
Add useful repr to all data classes.
2017-01-03 09:52:06 -05:00
Rapptz
79a49f9145
Absolute import some circular dependencies to appease Python 3.4.
2017-01-03 09:52:02 -05:00
Rapptz
59a0df5f98
Rename try_insert_user to store_user
2017-01-03 09:51:56 -05:00
Rapptz
5cb3ad14e8
Make emojis and members 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
31229a53e9
Optimise VoiceState for memory.
...
Instead of storing one VoiceState per Member, only store them if
necessary. This should bring down the number of instances
significantly.
2017-01-03 09:51:47 -05:00
Rapptz
044b0824e6
Begin working on the rewrite.
2017-01-03 09:51:47 -05:00
Rapptz
14def4b68e
Fix Member.server_permissions docstring.
2016-10-04 18:55:34 -04:00