184 Commits

Author SHA1 Message Date
Rapptz
8d583ea71b Update discriminator again for user_update events 2023-05-19 20:59:19 -04:00
Rapptz
8d17aa23c9 Remove @ prefix from usernames
Discord seemed to have backtracked on this display
2023-05-19 20:59:19 -04:00
Rapptz
9ebc13e160 Only use @ prefix in __str__ if the user is migrated 2023-05-19 20:59:19 -04:00
Rapptz
df01db3490 Initial support for pomelo migration 2023-05-19 20:59:19 -04:00
Soheab_
caf0fbdc1b
Correct permission for bypass_verification field in Member.edit 2023-02-13 06:26:32 -05:00
Soheab_
c46f309c13
Add support for member flags 2023-01-25 11:12:31 -05:00
Omkaar
c30a2f3ca0
Refactor certain f-strings and literals 2022-10-02 17:50:56 -04:00
Steve C
ce06beeb6c
Fix permissions-based docstrings to be more consistent 2022-09-17 14:07:39 -04:00
Ionite
6981eb69c4
Normalize type formatting in TypeError
Normalize most mixed usages of `__class__`, `__class__!r`, 
`__class__.__name__!r` to the standard form of 
`__class__.__name__`
2022-09-12 15:25:55 -04:00
Josh
e57617e157
Add support for delete_message_seconds ban argument 2022-08-28 02:06:57 -04:00
Rapptz
5c7f6dd37e Clarify when None is returned from Member.edit 2022-08-18 09:52:28 -04:00
Stocker
3ee18e4c5d
Use a TypeVar for flatten_user to workaround Pyright bug 2022-07-25 21:18:52 -04:00
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