-
-
Notifications
You must be signed in to change notification settings - Fork 114
/
channel.ts
310 lines (269 loc) · 9.53 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
import type {
APIChannel,
APIEmbed,
APIFollowedChannel,
APIInvite,
APIMessage,
APIMessageReference,
APIOverwrite,
APIUser,
ChannelType,
InviteTargetUserType,
MessageFlags,
OverwriteType,
} from '../../payloads/v6/mod.ts';
// #region TypeDefs
/**
* https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIOverwriteSend {
id: string;
type: OverwriteType;
allow: number | string;
deny: number | string;
}
/**
* https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export enum AllowedMentionsTypes {
Everyone = 'everyone',
Role = 'roles',
User = 'users',
}
/**
* https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mentions-structure
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface APIAllowedMentionsSend {
parse?: AllowedMentionsTypes[];
roles?: string[];
users?: string[];
}
// #endregion TypeDefs
/**
* https://discord.com/developers/docs/resources/channel#modify-channel
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPatchAPIChannelJSONBody {
name?: string;
type?: ChannelType.GUILD_NEWS | ChannelType.GUILD_TEXT;
position?: number | null;
topic?: string | null;
nsfw?: boolean | null;
rate_limit_per_user?: number | null;
user_limit?: number | null;
permission_overwrites?: APIOverwrite[] | null;
parent_id?: string | null;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIChannelResult = APIChannel;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIChannelResult = APIChannel;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIChannelResult = APIChannel;
/**
* https://discord.com/developers/docs/resources/channel#get-channel-messages
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPIChannelMessagesQuery {
around?: string;
before?: string;
after?: string;
limit?: number;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIChannelMessagesResult = APIMessage[];
/**
* https://discord.com/developers/docs/resources/channel#create-message
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIChannelMessageJSONBody {
content?: string;
nonce?: number | string;
tts?: boolean;
embed?: APIEmbed;
allowed_mentions?: APIAllowedMentionsSend;
message_reference?: APIMessageReference;
}
/**
* https://discord.com/developers/docs/resources/channel#create-message
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIChannelMessageFormDataBody =
| {
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| {
content?: string;
nonce?: number | string;
tts?: boolean;
embed?: APIEmbed;
allowed_mentions?: APIAllowedMentionsSend;
message_reference?: APIMessageReference;
/**
* The file contents
*/
file: unknown;
};
/**
* https://discord.com/developers/docs/resources/channel#edit-message
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPatchAPIChannelMessageJSONBody {
content?: string | null;
embed?: APIEmbed | null;
allowed_mentions?: APIAllowedMentionsSend | null;
flags?: MessageFlags | null;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIChannelMessageResult = APIMessage;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIChannelMessageResult = APIMessage;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPatchAPIChannelMessageResult = APIMessage;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIChannelMessageResult = never;
/**
* https://discord.com/developers/docs/resources/channel#get-reactions
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTGetAPIChannelMessageReactionsQuery {
before?: string;
after?: string;
limit?: number;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIChannelMessageReactionsResult = APIUser[];
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPutAPIChannelMessageReactionResult = never;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIChannelMessageReactionResult = never;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIChannelAllMessageReactionsResult = never;
/**
* https://discord.com/developers/docs/resources/channel#bulk-delete-messages
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIChannelMessagesBulkDeleteJSONBody {
messages: string[];
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIChannelMessagesBulkDeleteResult = never;
/**
* https://discord.com/developers/docs/resources/channel#edit-channel-permissions
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPutAPIChannelPermissionsJSONBody {
allow: number | string;
deny: number | string;
type: OverwriteType;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPutAPIChannelPermissionsResult = never;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIChannelPermissionsResult = never;
/**
* https://discord.com/developers/docs/resources/channel#get-channel-invites
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIChannelInvitesResult = APIInvite[];
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIChannelInviteJSONBody {
max_age?: number;
max_uses?: number;
temporary?: boolean;
unique?: boolean;
target_user_id?: string;
target_user_type?: InviteTargetUserType;
}
/**
* https://discord.com/developers/docs/resources/channel#trigger-typing-indicator
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIChannelTypingResult = never;
/**
* https://discord.com/developers/docs/resources/channel#get-pinned-messages
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTGetAPIChannelPinsResult = APIMessage[];
/**
* https://discord.com/developers/docs/resources/channel#add-pinned-channel-message
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPutAPIChannelPinResult = never;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIChannelPinResult = never;
/**
* https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPutAPIChannelRecipientJSONBody {
access_token: string;
nick?: string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPutAPIChannelRecipientResult = unknown;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTDeleteAPIChannelRecipientResult = unknown;
// TODO: Docs updated once https://github.com/discord/discord-api-docs/pull/1692/files is merged
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIChannelMessageCrosspostResult = APIMessage;
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export interface RESTPostAPIChannelFollowersJSONBody {
webhook_channel_id: string;
}
/**
* @deprecated API v6 is deprecated and the types will not receive further updates, please update to v8.
*/
export type RESTPostAPIChannelFollowersResult = APIFollowedChannel;