Add support for new RPC fields#10227
Merged
Rapptz merged 6 commits intoRapptz:masterfrom Jul 30, 2025
Merged
Conversation
dolfies
reviewed
Jul 11, 2025
Owner
|
Make them lowercase. The code does not care. >>> from discord.enums import Enum
>>> class X(Enum):
... name = 1
...
>>> X.name
<X.name: 1> |
Contributor
Author
Works. But the type checker doesn't understand it: class Enum(discord.Enum):
name = 0
# Type "Literal[0]" is not assignable to declared type "DynamicClassAttribute"
# "Literal[0]" is not assignable to "DynamicClassAttribute" Pylance reportAssignmentType
e = Enum.name
reveal_type(e) # DynamicClassAttribute
reveal_type(e.name)
# Cannot access attribute "name" for class "DynamicClassAttribute"
# Attribute "name" is unknown Pylance reportAttributeAccessIssue
reveal_type(e.value)
# Cannot access attribute "value" for class "DynamicClassAttribute"
# Attribute "value" is unknown Pylance reportAttributeAccessIssue |
Owner
|
File a bug with pylance. >>> import enum
>>> class Y(enum.Enum):
... name = 1
...
>>> Y.name
<Y.name: 1> |
Contributor
Author
It's apparently as designed. But i've lower-cased them. |
"it works"
Snipy7374
reviewed
Jul 19, 2025
Rapptz
requested changes
Jul 27, 2025
Owner
Rapptz
left a comment
There was a problem hiding this comment.
Looks mostly okay, just fix the pre-existing nits as well.
|
|
||
|
|
||
| class StatusDisplayType(Enum): | ||
| name = 0 # pyright: ignore[reportAssignmentType] |
Owner
There was a problem hiding this comment.
Did we figure out how this looks from a user's POV when they try using this attribute?
Contributor
Author
There was a problem hiding this comment.
Still the same as before when accessing .name or .value from the member, and no response to the comment left on the Pyright repository about it.
But to be fair, it works fine when setting or comparing it:
act = discord.Activity(
...
status_display_type=discord.StatusDisplayType.name,
)
print(act.status_display_type) # StatusDisplayType.name
if act.status_display_type is discord.StatusDisplayType.name:
print("Status display type is name")
Rapptz
approved these changes
Jul 30, 2025
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
discord/discord-api-docs#7674
Enum names are upped cased becausenameis an existing attribute.Bots don't support any of this, just like before.
Checklist