139 Commits

Author SHA1 Message Date
Rapptz
af8742a911 Use a specific tag type for member and user comparisons
The previous protocol based tag type caused significant overhead
(in the magnitude of seconds). Removing this should simplify object
creation by removing typing.Generic from the __mro__
2021-07-08 10:17:44 -04:00
Rapptz
1aeec34f84 Typehint Member and various typing fixes 2021-06-30 01:28:35 -04:00
Rapptz
a372aadb2d Rework Member.edit to not use kwargs for better typing 2021-06-29 21:54:24 -04:00
Steve C
20dd632722
Fix Member.ban typing to include 0-day message deletes 2021-06-27 23:38:29 -04:00
Michael H
1bf782fcb5
Add Member.get_role
Adds an efficient way to check if a member has a role by ID.

 This is done in a way consistent with the existing user API of the
 library.

 The more debated Member.has_role_id/has_role is intentionally not
 included for review at this time given the heavy bikeshedding of it.
2021-05-27 22:31:49 -04:00
Josh
5fa64e83e0
Fix issues with imports causing NameErrors 2021-05-12 20:24:28 -04:00
Nadir Chowdhury
757cfad38f
Type up **kwargs of various methods 2021-05-10 20:24:48 -04:00
Nadir Chowdhury
e4513f70ad
activities is no longer nullable 2021-04-17 18:56:51 -04:00
Rapptz
9eaf1e85e4 Rewrite Asset design
This is a breaking change.

This does the following transformations, assuming `asset` represents
an asset type.

Object.is_asset_animated() => Object.asset.is_animated()
Object.asset => Object.asset.key
Object.asset_url => Object.asset_url
Object.asset_url_as => Object.asset.replace(...)

Since the asset type now requires a key (or hash, if you will),
Emoji had to be flattened similar to how Attachment was done since
these assets are keyed solely ID.

Emoji.url (Asset) => Emoji.url (str)
Emoji.url_as => removed
Emoji.url.read => Emoji.read
Emoji.url.save => Emoji.save

This transformation was also done to PartialEmoji.
2021-04-16 11:27:23 -04:00
numbermaniac
208b16ed1b
Add note to member docs about Spotify limitation 2021-04-14 22:02:49 -04:00
Rapptz
1209585de5 Remove User.permissions_in
This seemed to only cause confusion.
2021-04-11 22:21:36 -04:00
Rapptz
7d79b4ba55 Remove Member related handling in PRESENCE_UPDATE 2021-04-11 00:57:59 -04:00
Nadir Chowdhury
89456022cf
Add __all__ to remaining modules 2021-04-07 02:30:32 -04:00
Rapptz
ff7094ce96 Convert datetimes to aware datetimes with UTC.
Naive datetimes will now be interpreted as local time throughout
the library.
2021-04-04 23:54:08 -04:00
Rapptz
9d39b135f4 Modernize code to use f-strings
This also removes the encoding on the top, since Python 3 does it by
default. It also changes some methods to use `yield from`.
2021-04-04 07:03:53 -04:00
Nadir Chowdhury
1b2688518e
Implement StageChannel and related methods 2021-04-03 22:43:41 -04:00
Sebastian Law
d6501159e7
[docs] copy signature from overridden and inherited methods 2021-03-29 23:52:14 -04:00
Sebastian Law
a06d00f554
Make await text appear in async Member method docs 2021-03-24 08:22:50 -04:00
Nadir Chowdhury
63ec23bac2
Code optimisations and refactoring via Sourcery 2021-02-24 21:26:51 -05:00
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