-
-
Notifications
You must be signed in to change notification settings - Fork 114
/
channel.ts
343 lines (317 loc) · 9.84 KB
/
channel.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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
/**
* Types extracted from https://discord.com/developers/docs/resources/channel
*/
import type { APIPartialEmoji } from './emoji.ts';
import type { APIGuildMember } from './guild.ts';
import type { APIUser } from './user.ts';
/**
* Not documented, but partial only includes id, name, and type
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIPartialChannel {
id: string;
type: ChannelType;
name?: string;
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIChannel extends APIPartialChannel {
guild_id?: string;
position?: number;
permission_overwrites?: APIOverwrite[];
name?: string;
topic?: string | null;
nsfw?: boolean;
last_message_id?: string | null;
bitrate?: number;
user_limit?: number;
rate_limit_per_user?: number;
recipients?: APIUser[];
icon?: string | null;
owner_id?: string;
application_id?: string;
parent_id?: string | null;
last_pin_timestamp?: string | null;
}
/**
* https://discord.com/developers/docs/resources/channel#channel-object-channel-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum ChannelType {
GUILD_TEXT = 0,
DM,
GUILD_VOICE,
GROUP_DM,
GUILD_CATEGORY,
GUILD_NEWS,
GUILD_STORE,
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIMessage {
id: string;
channel_id: string;
guild_id?: string;
author: APIUser;
member?: APIGuildMember;
content: string;
timestamp: string;
edited_timestamp: string | null;
tts: boolean;
mention_everyone: boolean;
mentions: (APIUser & { member?: Omit<APIGuildMember, 'user'> })[];
mention_roles: string[];
mention_channels?: APIChannelMention[];
attachments: APIAttachment[];
embeds: APIEmbed[];
reactions?: APIReaction[];
nonce?: string | number;
pinned: boolean;
webhook_id?: string;
type: MessageType;
activity?: APIMessageActivity;
application?: APIMessageApplication;
message_reference?: APIMessageReference;
flags?: MessageFlags;
referenced_message?: APIMessage | null;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum MessageType {
DEFAULT,
RECIPIENT_ADD,
RECIPIENT_REMOVE,
CALL,
CHANNEL_NAME_CHANGE,
CHANNEL_ICON_CHANGE,
CHANNEL_PINNED_MESSAGE,
GUILD_MEMBER_JOIN,
USER_PREMIUM_GUILD_SUBSCRIPTION,
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1,
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2,
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3,
CHANNEL_FOLLOW_ADD,
GUILD_DISCOVERY_DISQUALIFIED = 14,
GUILD_DISCOVERY_REQUALIFIED,
GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING,
GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING,
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIMessageActivity {
type: MessageActivityType;
party_id?: string;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-application-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIMessageApplication {
id: string;
cover_image?: string;
description: string;
icon: string | null;
name: string;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIMessageReference {
message_id?: string;
channel_id: string;
guild_id?: string;
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-activity-types
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum MessageActivityType {
JOIN = 1,
SPECTATE,
LISTEN,
JOIN_REQUEST = 5,
}
/**
* https://discord.com/developers/docs/resources/channel#message-object-message-flags
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum MessageFlags {
CROSSPOSTED = 1 << 0,
IS_CROSSPOST = 1 << 1,
SUPPRESS_EMBEDS = 1 << 2,
SOURCE_MESSAGE_DELETED = 1 << 3,
URGENT = 1 << 4,
}
/**
* https://discord.com/developers/docs/resources/channel#reaction-object-reaction-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIReaction {
count: number;
me: boolean;
emoji: APIPartialEmoji;
}
/**
* https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIOverwrite {
id: string;
type: OverwriteType;
/**
* @deprecated Use `allow_new` instead
*/
allow: number;
allow_new: string;
/**
* @deprecated Use `deny_new` instead
*/
deny: number;
deny_new: string;
}
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum OverwriteType {
Member = 'member',
Role = 'role',
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbed {
title?: string;
/**
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
*/
type?: EmbedType;
description?: string;
url?: string;
timestamp?: string;
color?: number;
footer?: APIEmbedFooter;
image?: APIEmbedImage;
thumbnail?: APIEmbedThumbnail;
video?: APIEmbedVideo;
provider?: APIEmbedProvider;
author?: APIEmbedAuthor;
fields?: APIEmbedField[];
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-types
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export enum EmbedType {
Rich = 'rich',
Image = 'image',
Video = 'video',
GifV = 'gifv',
Article = 'article',
Link = 'link',
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedThumbnail {
url?: string;
proxy_url?: string;
height?: number;
width?: number;
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedVideo {
url?: string;
height?: number;
width?: number;
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedImage {
url?: string;
proxy_url?: string;
height?: number;
width?: number;
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedProvider {
name?: string;
url?: string;
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedAuthor {
name?: string;
url?: string;
icon_url?: string;
proxy_icon_url?: string;
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedFooter {
text: string;
icon_url?: string;
proxy_icon_url?: string;
}
/**
* https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIEmbedField {
name: string;
value: string;
inline?: boolean;
}
/**
* https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAttachment {
id: string;
filename: string;
size: number;
url: string;
proxy_url: string;
height: number | null;
width: number | null;
}
/**
* https://discord.com/developers/docs/resources/channel#channel-mention-object-channel-mention-structure
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIChannelMention {
id: string;
guild_id: string;
type: ChannelType;
name: string;
}
/**
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIFollowedChannel {
channel_id: string;
webhook_id: string;
}