/
application.ts
281 lines (275 loc) · 8.78 KB
/
application.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
/**
* Types extracted from https://discord.com/developers/docs/resources/application
*/
import type { Permissions, Snowflake } from '../../globals.ts';
import type { LocalizationMap } from '../common.ts';
import type { APIPartialGuild } from './guild.ts';
import type { OAuth2Scopes } from './oauth2.ts';
import type { APITeam } from './teams.ts';
import type { APIUser } from './user.ts';
/**
* https://discord.com/developers/docs/resources/application#application-object
*/
export interface APIApplication {
/**
* The id of the app
*/
id: Snowflake;
/**
* The name of the app
*/
name: string;
/**
* The icon hash of the app
*/
icon: string | null;
/**
* The description of the app
*/
description: string;
/**
* An array of rpc origin urls, if rpc is enabled
*/
rpc_origins?: string[];
/**
* When `false` only app owner can join the app's bot to guilds
*/
bot_public: boolean;
/**
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
*/
bot_require_code_grant: boolean;
/**
* Partial user object for the bot user associated with the application
*/
bot?: APIUser;
/**
* The url of the application's terms of service
*/
terms_of_service_url?: string;
/**
* The url of the application's privacy policy
*/
privacy_policy_url?: string;
/**
* Partial user object containing info on the owner of the application
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
owner?: APIUser;
/**
* An empty string
*
* @deprecated This field will be removed in v11
*/
summary: '';
/**
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
*
* See https://discord.com/developers/docs/game-sdk/applications#getticket
*/
verify_key: string;
/**
* The team this application belongs to
*
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
*/
team: APITeam | null;
/**
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
*/
guild_id?: Snowflake;
/**
* A partial object of the associated guild
*/
guild?: APIPartialGuild;
/**
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
*/
primary_sku_id?: Snowflake;
/**
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
*/
slug?: string;
/**
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
*/
cover_image?: string;
/**
* The application's public flags
*
* See https://discord.com/developers/docs/resources/application#application-object-application-flags
*/
flags: ApplicationFlags;
/**
* Approximate count of guilds the application has been added to
*/
approximate_guild_count?: number;
/**
* Array of redirect URIs for the application
*/
redirect_uris?: string[];
/**
* The interactions endpoint URL for the application
*/
interactions_endpoint_url?: string;
/**
* The application's role connection verification entry point,
* which when configured will render the app as a verification method in the guild role verification configuration
*/
role_connections_verification_url?: string;
/**
* Up to 5 tags of max 20 characters each describing the content and functionality of the application
*/
tags?: [string, string?, string?, string?, string?];
/**
* Settings for the application's default in-app authorization link, if enabled
*/
install_params?: APIApplicationInstallParams;
/**
* The application's default custom authorization link, if enabled
*/
custom_install_url?: string;
}
export interface APIApplicationInstallParams {
scopes: OAuth2Scopes[];
permissions: Permissions;
}
/**
* https://discord.com/developers/docs/resources/application#application-object-application-flags
*/
export enum ApplicationFlags {
/**
* @unstable This application flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
EmbeddedReleased = 1 << 1,
/**
* @unstable This application flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
ManagedEmoji = 1 << 2,
/**
* @unstable This application flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
EmbeddedIAP = 1 << 3,
/**
* @unstable This application flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
GroupDMCreate = 1 << 4,
/**
* Indicates if an app uses the Auto Moderation API
*/
ApplicationAutoModerationRuleCreateBadge = 1 << 6,
/**
* @unstable This application flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
RPCHasConnected = 1 << 11,
/**
* Intent required for bots in 100 or more servers to receive `presence_update` events
*/
GatewayPresence = 1 << 12,
/**
* Intent required for bots in under 100 servers to receive `presence_update` events, found in Bot Settings
*/
GatewayPresenceLimited = 1 << 13,
/**
* Intent required for bots in 100 or more servers to receive member-related events like `guild_member_add`.
* See list of member-related events [under `GUILD_MEMBERS`](https://discord.com/developers/docs/topics/gateway#list-of-intents)
*/
GatewayGuildMembers = 1 << 14,
/**
* Intent required for bots in under 100 servers to receive member-related events like `guild_member_add`, found in Bot Settings.
* See list of member-related events [under `GUILD_MEMBERS`](https://discord.com/developers/docs/topics/gateway#list-of-intents)
*/
GatewayGuildMembersLimited = 1 << 15,
/**
* Indicates unusual growth of an app that prevents verification
*/
VerificationPendingGuildLimit = 1 << 16,
/**
* Indicates if an app is embedded within the Discord client (currently unavailable publicly)
*/
Embedded = 1 << 17,
/**
* Intent required for bots in 100 or more servers to receive [message content](https://support-dev.discord.com/hc/en-us/articles/4404772028055)
*/
GatewayMessageContent = 1 << 18,
/**
* Intent required for bots in under 100 servers to receive [message content](https://support-dev.discord.com/hc/en-us/articles/4404772028055),
* found in Bot Settings
*/
GatewayMessageContentLimited = 1 << 19,
/**
* @unstable This application flag is currently not documented by Discord but has a known value which we will try to keep up to date.
*/
EmbeddedFirstParty = 1 << 20,
/**
* Indicates if an app has registered global [application commands](https://discord.com/developers/docs/interactions/application-commands)
*/
ApplicationCommandBadge = 1 << 23,
}
/**
* https://discord.com/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object-application-role-connection-metadata-structure
*/
export interface APIApplicationRoleConnectionMetadata {
/**
* Type of metadata value
*/
type: ApplicationRoleConnectionMetadataType;
/**
* Dictionary key for the metadata field (must be `a-z`, `0-9`, or `_` characters; 1-50 characters)
*/
key: string;
/**
* Name of the metadata field (1-100 characters)
*/
name: string;
/**
* Translations of the name
*/
name_localizations?: LocalizationMap;
/**
* Description of the metadata field (1-200 characters)
*/
description: string;
/**
* Translations of the description
*/
description_localizations?: LocalizationMap;
}
/**
* https://discord.com/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object-application-role-connection-metadata-type
*/
export enum ApplicationRoleConnectionMetadataType {
/**
* The metadata value (`integer`) is less than or equal to the guild's configured value (`integer`)
*/
IntegerLessThanOrEqual = 1,
/**
* The metadata value (`integer`) is greater than or equal to the guild's configured value (`integer`)
*/
IntegerGreaterThanOrEqual,
/**
* The metadata value (`integer`) is equal to the guild's configured value (`integer`)
*/
IntegerEqual,
/**
* The metadata value (`integer`) is not equal to the guild's configured value (`integer`)
*/
IntegerNotEqual,
/**
* The metadata value (`ISO8601 string`) is less than or equal to the guild's configured value (`integer`; days before current date)
*/
DatetimeLessThanOrEqual,
/**
* The metadata value (`ISO8601 string`) is greater than or equal to the guild's configured value (`integer`; days before current date)
*/
DatetimeGreaterThanOrEqual,
/**
* The metadata value (`integer`) is equal to the guild's configured value (`integer`; `1`)
*/
BooleanEqual,
/**
* The metadata value (`integer`) is not equal to the guild's configured value (`integer`; `1`)
*/
BooleanNotEqual,
}