172 Commits

Author SHA1 Message Date
Rapptz
2b3cc8fe10 Add Member.display_icon to get the rendered member icon 2022-04-18 17:26:30 -04:00
Willy
bc91e1667f
Fix typo in Member.timeout docs 2022-04-06 22:11:54 -04:00
Alex Nørgaard
0263774e13
Remove the use of ! in the Member.mention property 2022-04-06 01:05:37 -04:00
Rapptz
a5f1c2f592 Take into consideration member timeouts in permission calculations 2022-04-01 09:32:54 -04:00
Rapptz
5096846c4e Allow None to be passed for Member.timeout 2022-04-01 00:09:02 -04:00
Bryan Forbes
06c257760b
Update types to use Awaitable where possible 2022-03-30 22:00:24 -04:00
Kellen
4fd2d5fdfd
Remove redundant imports and variables 2022-03-29 02:50:34 -04:00
chromacoat dreamkey
dd3536be63
Fix typo in Member.edit documentation 2022-03-26 21:21:15 -04:00
Rapptz
5f7c5abe0a Change ban type hints to use int instead of Literal 2022-03-18 21:45:15 -04:00
Josh
e01d4a31eb
Replace invariant container types with wider types where applicable 2022-03-17 07:26:01 -04:00
Stocker
5aa696ccfa
Fix typing issues and improve typing completeness across the library
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
Co-authored-by: Josh <josh.ja.butt@gmail.com>
2022-03-13 23:52:10 -04:00
Rapptz
f4ca36ec5a Add Member.timeout helper method 2022-03-10 21:32:33 -05:00
Sebastian Law
483ffeacd4
Inject state into PartialEmoji in Activity 2022-03-10 20:56:20 -05:00
Lucas Hardt
8825bf922f
Fix Member.move_to typehint and docstring 2022-03-09 07:41:51 -05:00
apple502j
aa6fb54e99
Raise ClientException in Member.request_to_speak 2022-03-07 04:10:11 -05:00
Lilly Rose Berner
85b6175137
Create ClientStatus type to improve Member memory usage 2022-03-05 23:26:55 -05:00
Rapptz
f80f81c395 Add Member.resolved_permissions attribute for interaction members 2022-03-02 01:39:39 -05:00
Josh
147948af9b
Use typing.Self throughout library 2022-03-01 07:53:24 -05:00
Josh
285069de08 Fix types in guild.py 2022-02-22 04:00:46 -05:00
Nadir Chowdhury
3cf000d467
Type up gateway payloads 2022-02-21 22:09:40 -05:00
Rapptz
88b520b5ab Reformat code using black
Segments where readability was hampered were fixed by appropriate
format skipping directives. New code should hopefully be black
compatible. The moment they remove the -S option is probably the moment
I stop using black though.
2022-02-20 08:04:58 -05:00
Maya
a1dbc0ca27
Add member timeouts and relevant permissions 2022-02-18 03:24:28 -05:00
Izhar Ahmad
efec816de2
Make arguments positional only in 2 get methods
- Member.get_role
- Guild.get_member
2021-08-25 20:52:20 -04:00
Rapptz
848d752388 Change User.avatar to be Optional[Asset] instead of Asset
This change was needed to allow users to more easily check if an
uploaded avatar was set using `if user.avatar:` rather than the
admittedly clunky `if user.avatar != user.default_avatar.

The old behaviour with a fallback is still useful for actual display
purposes, so it has been moved over to the new `User.display_avatar`
attribute. This also has symmetry with the newly added
`Member.display_avatar` attribute.
2021-08-25 01:43:09 -04:00
Rapptz
490bbffc93 Remove in-place edits and return fresh instances instead
Fixes #4098
2021-08-23 23:46:50 -04:00
Rapptz
cff9ca0288 Fix typings for member HTTP methods 2021-08-23 23:44:20 -04:00
Rapptz
d7a4230007 Fix Member.guild_avatar docstring 2021-08-22 07:07:26 -04:00
Rapptz
49cf959784 Fix Member._avatar not updating in member update events 2021-08-22 06:54:38 -04:00
JustAnyone
91652e3b60
Add per-guild member avatar support
Fix #7054
2021-08-22 06:49:42 -04:00
Arnav Jindal
6c36df6c11
Add missing typehints for Member properties 2021-08-21 14:18:27 -04:00
Josh
745cf541ea
Re-define Member properties inferred from User to support type-checking 2021-08-20 20:02:39 -04:00
Rapptz
6beef898c6 Rename instances of nitro to premium 2021-07-30 23:10:36 -04:00
Rapptz
ecf239d2a2 Fix user cache acting incorrectly with evictions
The first issue involved copied users which would lead to user updates
causing faster evictions of the cache than was expected.

The second issue involved users that weren't bound to an internal
lifetime eviction policy. These users would not get evicted.
For example, a user without mutual guilds or being part of the internal
cache in general (messages, DMs) would never end up being evicted for
some strange reason. To handle this case, store_user would get a
counterpart named create_user which would create a user without
potentially storing them in the cache. That way only users with a
bound lifetime within the library would be stored.
2021-07-29 01:43:23 -04:00
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