29
29
30
30
from . import utils
31
31
from .asset import Asset
32
+ from .permissions import Permissions
32
33
33
34
if TYPE_CHECKING :
34
35
from .guild import Guild
35
36
from .state import ConnectionState
36
37
from .types .appinfo import AppInfo as AppInfoPayload
38
+ from .types .appinfo import AppInstallParams as AppInstallParamsPayload
37
39
from .types .appinfo import PartialAppInfo as PartialAppInfoPayload
38
40
from .types .appinfo import Team as TeamPayload
39
41
from .user import User
40
42
41
43
__all__ = (
42
44
"AppInfo" ,
43
45
"PartialAppInfo" ,
46
+ "AppInstallParams" ,
44
47
)
45
48
46
49
@@ -70,11 +73,6 @@ class AppInfo:
70
73
grant flow to join.
71
74
rpc_origins: Optional[List[:class:`str`]]
72
75
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
78
76
79
77
verify_key: :class:`str`
80
78
The hex encoded key for verification in interactions and the
@@ -110,6 +108,48 @@ class AppInfo:
110
108
The application's privacy policy URL, if set.
111
109
112
110
.. 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
113
153
"""
114
154
115
155
__slots__ = (
@@ -122,7 +162,7 @@ class AppInfo:
122
162
"bot_require_code_grant" ,
123
163
"owner" ,
124
164
"_icon" ,
125
- "summary " ,
165
+ "_summary " ,
126
166
"verify_key" ,
127
167
"team" ,
128
168
"guild_id" ,
@@ -131,6 +171,14 @@ class AppInfo:
131
171
"_cover_image" ,
132
172
"terms_of_service_url" ,
133
173
"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" ,
134
182
)
135
183
136
184
def __init__ (self , state : ConnectionState , data : AppInfoPayload ):
@@ -149,7 +197,7 @@ def __init__(self, state: ConnectionState, data: AppInfoPayload):
149
197
team : TeamPayload | None = data .get ("team" )
150
198
self .team : Team | None = Team (state , team ) if team else None
151
199
152
- self .summary : str = data ["summary" ]
200
+ self ._summary : str = data ["summary" ]
153
201
self .verify_key : str = data ["verify_key" ]
154
202
155
203
self .guild_id : int | None = utils ._get_as_snowflake (data , "guild_id" )
@@ -161,6 +209,24 @@ def __init__(self, state: ConnectionState, data: AppInfoPayload):
161
209
self ._cover_image : str | None = data .get ("cover_image" )
162
210
self .terms_of_service_url : str | None = data .get ("terms_of_service_url" )
163
211
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" )
164
230
165
231
def __repr__ (self ) -> str :
166
232
return (
@@ -195,6 +261,23 @@ def guild(self) -> Guild | None:
195
261
"""
196
262
return self ._state ._get_guild (self .guild_id )
197
263
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
+
198
281
199
282
class PartialAppInfo :
200
283
"""Represents a partial AppInfo given by :func:`~discord.abc.GuildChannel.create_invite`
@@ -257,3 +340,23 @@ def icon(self) -> Asset | None:
257
340
if self ._icon is None :
258
341
return None
259
342
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