Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/1519.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support :class:`ApplicationFlags` beyond bit 30 by using ``flags_new``.
2 changes: 1 addition & 1 deletion disnake/appinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def __init__(self, state: ConnectionState, data: AppInfoPayload) -> None:
self.terms_of_service_url: str | None = data.get("terms_of_service_url")
self.privacy_policy_url: str | None = data.get("privacy_policy_url")

flags: int | None = data.get("flags")
flags: int | None = utils._get_as_snowflake(data, "flags_new")
self.flags: ApplicationFlags | None = (
ApplicationFlags._from_value(flags) if flags is not None else None
)
Expand Down
4 changes: 2 additions & 2 deletions disnake/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def parse_ready(self, data: gateway.ReadyEvent) -> None:
else:
if self.application_id is None:
self.application_id = utils._get_as_snowflake(application, "id")
self.application_flags = ApplicationFlags._from_value(application["flags"])
self.application_flags = ApplicationFlags._from_value(int(application["flags_new"]))

for guild_data in data["guilds"]:
self._add_guild_from_data(guild_data)
Expand Down Expand Up @@ -2580,7 +2580,7 @@ def parse_ready(self, data: gateway.ReadyEvent) -> None:
else:
if self.application_id is None:
self.application_id = utils._get_as_snowflake(application, "id")
self.application_flags = ApplicationFlags._from_value(application["flags"])
self.application_flags = ApplicationFlags._from_value(int(application["flags_new"]))

for guild_data in data["guilds"]:
self._add_guild_from_data(guild_data)
Expand Down
3 changes: 3 additions & 0 deletions disnake/types/appinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class AppInfo(BaseAppInfo):
owner: User
team: NotRequired[Team]
flags: NotRequired[int]
flags_new: NotRequired[str] # like `flags`, but also contains flags beyond bit 30
guild_id: NotRequired[Snowflake]
primary_sku_id: NotRequired[Snowflake]
slug: NotRequired[str]
Expand All @@ -68,12 +69,14 @@ class PartialAppInfo(BaseAppInfo, total=False):
rpc_origins: list[str]
cover_image: str
flags: int
flags_new: str # like `flags`, but also contains flags beyond bit 30


# see https://docs.discord.com/developers/events/gateway-events#ready-ready-event-fields
class PartialGatewayAppInfo(TypedDict):
id: Snowflake
flags: int
flags_new: str # like `flags`, but also contains flags beyond bit 30


class EditAppInfo(TypedDict, total=False):
Expand Down
Loading