120 Commits

Author SHA1 Message Date
Lucas
d7b41e0a21
Fix User public flags not updating 2021-01-17 00:09:15 -05:00
Nihaal Sangha
69bdc3a184
Change copyright year to present 2021-01-15 05:28:11 -05:00
Perry Cate
bbbda4ec00
Update add_roles docstring to mention role order. 2021-01-14 03:11:58 -05:00
Rapptz
93f102ca90 Add support for Member.pending boolean attribute 2020-12-18 21:02:22 -05:00
Nadir Chowdhury
6b803acde4
[chore] Remove redundant imports
This also removes the historical patch for NullHandler implemented in bbf1c54, as it has been available since Python 3.1.
2020-11-28 03:16:49 -05:00
Rapptz
f2de794bde Intern status and overwrite strings 2020-09-23 03:21:20 -04:00
Rapptz
23ae084b8c Allow finer grained control over the member cache. 2020-09-23 03:21:20 -04:00
Rapptz
c261f7c4a3 Handle user updates within GUILD_MEMBER_UPDATE 2020-09-23 03:21:16 -04:00
Michael
93fa46713a
Fix and add documentation 2020-09-23 03:19:35 -04:00
Rapptz
a183c4f752 Completely update member references from message inner members.
Fixes #5819
2020-09-17 02:45:53 -04:00
rodovia
15f51113c3
Fix Member.joined_at documentation 2020-09-09 19:44:33 -04:00
Skezza
c3bca7ec73
Documentation formatting 2020-06-30 23:32:00 -04:00
Sebastian Law
b4b953bfc6
Fix various inconsistencies within the documentation (#5067) 2020-06-28 03:45:58 -04:00
Michael H
7bef78284f
Removes the caching behavior of Member.roles
- fixes 4087
- This intentionally uses some internals in both Member.roles and
Member.top_role to retain as much performance as possible while
removing the cache
2020-06-04 23:38:11 -04:00
JohnyTheCarrot
ab5f995d78 Add support for public user flags 2020-05-29 22:40:14 -04:00
kittenswolf
6decfd1d1a Fix colour properties being displayed as methods in the documentation. 2020-05-03 15:40:13 -04:00
Rapptz
02397306b2 Drop superfluous zero in version related changes in the documentation 2020-01-21 03:47:56 -05:00
Rapptz
6071607176 Bump copyright year to 2020
Closes #2510
2020-01-19 20:03:00 -05:00
Rapptz
42a084028c Expose _ActivityTag as BaseActivity to easily refer to. 2020-01-14 20:56:00 -05:00
Rapptz
de5caf59d6 Cache member.roles access to avoid surprising performance traps
Without the cache, repeated access could be accidentally quadratic or
worse.
2020-01-06 22:13:35 -05:00
Rapptz
f1118273f5 Fix Member.mentioned_in returning True if in separate guilds 2020-01-06 00:30:04 -05:00
Willy
99b61f973f Added Optional to VoiceState.channel type 2019-11-15 04:23:15 -05:00
Joshua B
8240454555 Add self_stream property to VoiceState object. 2019-09-19 21:21:54 -04:00
Rapptz
562580a07f Use lower level Guild.owner_id for permission resolution. 2019-07-10 14:30:53 -04:00
Rapptz
91f1f430e1 Fix NameError in member upgrade code 2019-07-10 06:11:03 -04:00
Rapptz
bbc50c92d0 Add upgraded Member to Message.mentions in case of no cache. 2019-07-10 04:51:27 -04:00
Rapptz
5c1b239b47 Different method of upgrading user instances 2019-07-10 01:23:38 -04:00
SnowyLuma
2b4cf5dafc Set premium_since when copying and updating Member 2019-06-11 21:13:43 +02:00
NCPlayz
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
Rapptz
2b27a7a9d5 Add Member.premium_since to denote member boost date. 2019-06-04 18:30:46 -04:00
Rapptz
3c387e9031 Use attrgetter to speed up Member attribute access by 2x. 2019-05-25 03:14:35 -04:00
Rapptz
4dee175d2a Add support for voice kicking. 2019-04-30 00:34:20 -04:00
Rapptz
f8999b63ae Fix long-standing issue with user updates not dispatching properly.
This fix is long coming. For a long time due to the addition of a
global user cache, the on_member_update event would only have the
updated user in the very first dispatch due to a quirk in the reference
only being updated once.

In order to fix this issue two things had to change:

1. There had to be a new event, `on_user_update` to complement
   the equivalent member event.
2. Unnecessary copies of User had to be removed to compensate for the
   performance hit from the diffing.

While doing these two fixes I also re-evaluated some more unnecessary
copies done during the PRESENCE_UPDATE to add member case while
fetch_offline_members=False is set or due to chunking issues. The
number of copies was brought down from 2 to 1, discounting the original
Member creation. Unsure on the benefits of this one, however.

N.B: this doesn't change the pre-existing behaviour of on_member_update
2019-04-08 07:45:04 -04:00
Rapptz
1a9726087a GUILD_MEMBER_UPDATE no longer does actual user updates.
This had been delegated to PRESENCE_UPDATE a long time ago,
unfortunately.
2019-04-08 06:34:28 -04:00
Rapptz
c9fd092476 Don't use an enum when unnecessary in Member._client_status 2019-04-08 04:06:01 -04:00
NCPlayz
fb02191b80 Organise documentation 2019-03-19 08:24:42 -04:00
Rapptz
7240d170c1 Update Member.joined_at on MESSAGE_CREATE and document it can be None.
Fixes #1638
2019-02-27 06:23:08 -05:00
DerpyChap
7ab47c223b Add self_video property to VoiceState 2019-02-18 03:48:26 -05:00
Dante Dam
9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05:00
Rapptz
26bb6c6ddc Fix some lingering attribute setting issues. 2018-12-14 21:59:31 -05:00
Rapptz
c7396dc8ac Add support for mobile indicators and per-client statuses. 2018-12-14 20:57:21 -05:00
Hornwitser
7fe4c999fb Actually drop copy.copy in Member
Remove the old and slow Member._copy implementation that was left over
by accident in 095f0ec.  Since it was defined later it overrode the new
implementation and rendered it moot.
2018-11-24 22:38:49 -05:00
SnowyLuma
e89e7dfe93 Add support for multiple activities 2018-11-24 22:36:52 -05:00
Rapptz
860d6a9ace Revert "Rework documentation to not duplicate inherited members."
This reverts commit 96981210b3415e15446db0b702b07fef25c8b680.
2018-10-11 03:42:01 -04:00
Rapptz
96981210b3 Rework documentation to not duplicate inherited members.
This will probably be reverted in 1 week.
2018-10-03 05:45:30 -04:00
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