Skip to content

Commit

Permalink
Add approximate_guild_count field to own Application (#1712)
Browse files Browse the repository at this point in the history
  • Loading branch information
davfsa authored Sep 10, 2023
1 parent f6d737e commit 96edf79
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions changes/1712.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add `approximate_guild_count` field to own `Application`
3 changes: 3 additions & 0 deletions hikari/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@ class Application(guilds.PartialApplication):
install_parameters: typing.Optional[ApplicationInstallParameters] = attrs.field(eq=False, hash=False, repr=False)
"""Settings for the application's default in-app authorization link, if enabled."""

approximate_guild_count: int = attrs.field(eq=False, hash=False, repr=False)
"""The approximate number of guilds this application is part of."""

@property
def cover_image_url(self) -> typing.Optional[files.URL]:
"""Rich presence cover image URL for this application, if set."""
Expand Down
1 change: 1 addition & 0 deletions hikari/impl/entity_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ def deserialize_application(self, payload: data_binding.JSONObject) -> applicati
custom_install_url=payload.get("custom_install_url"),
tags=payload.get("tags") or [],
install_parameters=install_parameters,
approximate_guild_count=payload["approximate_guild_count"],
)

def deserialize_authorization_information(
Expand Down
4 changes: 4 additions & 0 deletions tests/hikari/impl/test_entity_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,7 @@ def application_payload(self, owner_payload, user_payload):
"custom_install_url": "https://dontinstallme.com",
"tags": ["i", "like", "hikari"],
"install_params": {"scopes": ["bot", "applications.commands"], "permissions": 8},
"approximate_guild_count": 10000,
}

def test_deserialize_application(
Expand All @@ -1001,6 +1002,7 @@ def test_deserialize_application(
assert application.custom_install_url == "https://dontinstallme.com"
assert application.tags == ["i", "like", "hikari"]
assert application.icon_hash == "iwiwiwiwiw"
assert application.approximate_guild_count == 10000
# Install Parameters
assert application.install_parameters.scopes == [
application_models.OAuth2Scope.BOT,
Expand Down Expand Up @@ -1037,6 +1039,7 @@ def test_deserialize_application_with_unset_fields(self, entity_factory_impl, mo
"verify_key": "1232313223",
"flags": 0,
"owner": owner_payload,
"approximate_guild_count": 10000,
}
)

Expand All @@ -1061,6 +1064,7 @@ def test_deserialize_application_with_null_fields(self, entity_factory_impl, moc
"bot_require_code_grant": False,
"verify_key": "1232313223",
"flags": 0,
"approximate_guild_count": 10000,
}
)

Expand Down

0 comments on commit 96edf79

Please sign in to comment.