2929
3030from . import utils
3131from .asset import Asset
32+ from .permissions import Permissions
3233
3334if TYPE_CHECKING :
3435 from .guild import Guild
3536 from .state import ConnectionState
3637 from .types .appinfo import AppInfo as AppInfoPayload
38+ from .types .appinfo import AppInstallParams as AppInstallParamsPayload
3739 from .types .appinfo import PartialAppInfo as PartialAppInfoPayload
3840 from .types .appinfo import Team as TeamPayload
3941 from .user import User
4042
4143__all__ = (
4244 "AppInfo" ,
4345 "PartialAppInfo" ,
46+ "AppInstallParams" ,
4447)
4548
4649
@@ -70,11 +73,6 @@ class AppInfo:
7073 grant flow to join.
7174 rpc_origins: Optional[List[:class:`str`]]
7275 A list of RPC origin URLs, if RPC is enabled.
73- summary: :class:`str`
74- If this application is a game sold on Discord,
75- this field will be the summary field for the store page of its primary SKU.
76-
77- .. versionadded:: 1.3
7876
7977 verify_key: :class:`str`
8078 The hex encoded key for verification in interactions and the
@@ -110,6 +108,48 @@ class AppInfo:
110108 The application's privacy policy URL, if set.
111109
112110 .. versionadded:: 2.0
111+
112+ approximate_guild_count: Optional[:class:`int`]
113+ The approximate count of guilds to which the app has been added, if any.
114+
115+ .. versionadded:: 2.7
116+
117+ approximate_user_install_count: Optional[:class:`int`]
118+ The approximate count of users who have installed the application, if any.
119+
120+ .. versionadded:: 2.7
121+
122+ redirect_uris: Optional[List[:class:`str`]]
123+ The list of redirect URIs for the application, if set.
124+
125+ .. versionadded:: 2.7
126+
127+ interactions_endpoint_url: Optional[:class:`str`]
128+ The interactions endpoint URL for the application, if set.
129+
130+ .. versionadded:: 2.7
131+
132+ role_connections_verification_url: Optional[:class:`str`]
133+ The role connection verification URL for the application, if set.
134+
135+ .. versionadded:: 2.7
136+
137+ install_params: Optional[List[:class:`AppInstallParams`]]
138+ The settings for the application's default in-app authorization link, if set.
139+
140+ .. versionadded:: 2.7
141+
142+ tags: Optional[List[:class:`str`]]
143+ The list of tags describing the content and functionality of the app, if set.
144+
145+ Maximium of 5 tags.
146+
147+ .. versionadded:: 2.7
148+
149+ custom_install_url: Optional[:class:`str`]
150+ The default custom authorization URL for the application, if set.
151+
152+ .. versionadded:: 2.7
113153 """
114154
115155 __slots__ = (
@@ -122,7 +162,7 @@ class AppInfo:
122162 "bot_require_code_grant" ,
123163 "owner" ,
124164 "_icon" ,
125- "summary " ,
165+ "_summary " ,
126166 "verify_key" ,
127167 "team" ,
128168 "guild_id" ,
@@ -131,6 +171,14 @@ class AppInfo:
131171 "_cover_image" ,
132172 "terms_of_service_url" ,
133173 "privacy_policy_url" ,
174+ "approximate_guild_count" ,
175+ "approximate_user_install_count" ,
176+ "redirect_uris" ,
177+ "interactions_endpoint_url" ,
178+ "role_connections_verification_url" ,
179+ "install_params" ,
180+ "tags" ,
181+ "custom_install_url" ,
134182 )
135183
136184 def __init__ (self , state : ConnectionState , data : AppInfoPayload ):
@@ -149,7 +197,7 @@ def __init__(self, state: ConnectionState, data: AppInfoPayload):
149197 team : TeamPayload | None = data .get ("team" )
150198 self .team : Team | None = Team (state , team ) if team else None
151199
152- self .summary : str = data ["summary" ]
200+ self ._summary : str = data ["summary" ]
153201 self .verify_key : str = data ["verify_key" ]
154202
155203 self .guild_id : int | None = utils ._get_as_snowflake (data , "guild_id" )
@@ -161,6 +209,24 @@ def __init__(self, state: ConnectionState, data: AppInfoPayload):
161209 self ._cover_image : str | None = data .get ("cover_image" )
162210 self .terms_of_service_url : str | None = data .get ("terms_of_service_url" )
163211 self .privacy_policy_url : str | None = data .get ("privacy_policy_url" )
212+ self .approximate_guild_count : int | None = data .get ("approximate_guild_count" )
213+ self .approximate_user_install_count : int | None = data .get (
214+ "approximate_user_install_count"
215+ )
216+ self .redirect_uris : list [str ] | None = data .get ("redirect_uris" , [])
217+ self .interactions_endpoint_url : str | None = data .get (
218+ "interactions_endpoint_url"
219+ )
220+ self .role_connections_verification_url : str | None = data .get (
221+ "role_connections_verification_url"
222+ )
223+
224+ install_params = data .get ("install_params" )
225+ self .install_params : AppInstallParams | None = (
226+ AppInstallParams (install_params ) if install_params else None
227+ )
228+ self .tags : list [str ] | None = data .get ("tags" , [])
229+ self .custom_install_url : str | None = data .get ("custom_install_url" )
164230
165231 def __repr__ (self ) -> str :
166232 return (
@@ -195,6 +261,23 @@ def guild(self) -> Guild | None:
195261 """
196262 return self ._state ._get_guild (self .guild_id )
197263
264+ @property
265+ def summary (self ) -> str | None :
266+ """If this application is a game sold on Discord,
267+ this field will be the summary field for the store page of its primary SKU.
268+
269+ It currently returns an empty string.
270+
271+ .. versionadded:: 1.3
272+ .. deprecated:: 2.7
273+ """
274+ utils .warn_deprecated (
275+ "summary" ,
276+ "description" ,
277+ reference = "https://discord.com/developers/docs/resources/application#application-object-application-structure" ,
278+ )
279+ return self ._summary
280+
198281
199282class PartialAppInfo :
200283 """Represents a partial AppInfo given by :func:`~discord.abc.GuildChannel.create_invite`
@@ -257,3 +340,23 @@ def icon(self) -> Asset | None:
257340 if self ._icon is None :
258341 return None
259342 return Asset ._from_icon (self ._state , self .id , self ._icon , path = "app" )
343+
344+
345+ class AppInstallParams :
346+ """Represents the settings for the custom authorization URL of an application.
347+
348+ .. versionadded:: 2.7
349+
350+ Attributes
351+ ----------
352+ scopes: List[:class:`str`]
353+ The list of OAuth2 scopes for adding the application to a guild.
354+ permissions: :class:`Permissions`
355+ The permissions to request for the bot role in the guild.
356+ """
357+
358+ __slots__ = ("scopes" , "permissions" )
359+
360+ def __init__ (self , data : AppInstallParamsPayload ) -> None :
361+ self .scopes : list [str ] = data .get ("scopes" , [])
362+ self .permissions : Permissions = Permissions (int (data ["permissions" ]))
0 commit comments