@koishijs/plugin-adapter-discord 2.0.0-beta.7 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { Application, Channel, ChannelType, Component, GuildMember, integer, MessageInteraction, Reaction, snowflake, Sticker, StickerItem, timestamp, User } from '.';
1
+ import { AllowedMentions, Application, Channel, Component, GuildMember, integer, MessageInteraction, Reaction, snowflake, Sticker, timestamp, User } from '.';
2
2
  /** https://discord.com/developers/docs/resources/channel#message-object-message-structure */
3
3
  export interface Message {
4
4
  /** id of the message */
@@ -40,15 +40,15 @@ export interface Message {
40
40
  /** if the message is generated by a webhook, this is the webhook's id */
41
41
  webhook_id?: snowflake;
42
42
  /** type of message */
43
- type: integer;
43
+ type: Message.Type;
44
44
  /** sent with Rich Presence-related chat embeds */
45
- activity?: MessageActivity;
45
+ activity?: Message.Activity;
46
46
  /** sent with Rich Presence-related chat embeds */
47
47
  application?: Partial<Application>;
48
48
  /** if the message is a response to an Interaction, this is the id of the interaction's application */
49
49
  application_id?: snowflake;
50
50
  /** data showing the source of a crosspost, channel follow add, pin, or reply message */
51
- message_reference?: MessageReference;
51
+ message_reference?: Message.Reference;
52
52
  /** message flags combined as a bitfield */
53
53
  flags?: integer;
54
54
  /** the message associated with the message_reference */
@@ -60,79 +60,123 @@ export interface Message {
60
60
  /** sent if the message contains components like buttons, action rows, or other interactive components */
61
61
  components?: Component[];
62
62
  /** sent if the message contains stickers */
63
- sticker_items?: StickerItem[];
64
- /** Deprecated the stickers sent with the message */
65
- stickers?: Sticker[];
63
+ sticker_items?: Sticker.Item[];
66
64
  }
67
- /** https://discord.com/developers/docs/resources/channel#message-object-message-types */
68
- export declare enum MessageType {
69
- DEFAULT = 0,
70
- RECIPIENT_ADD = 1,
71
- RECIPIENT_REMOVE = 2,
72
- CALL = 3,
73
- CHANNEL_NAME_CHANGE = 4,
74
- CHANNEL_ICON_CHANGE = 5,
75
- CHANNEL_PINNED_MESSAGE = 6,
76
- GUILD_MEMBER_JOIN = 7,
77
- USER_PREMIUM_GUILD_SUBSCRIPTION = 8,
78
- USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1 = 9,
79
- USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = 10,
80
- USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = 11,
81
- CHANNEL_FOLLOW_ADD = 12,
82
- GUILD_DISCOVERY_DISQUALIFIED = 14,
83
- GUILD_DISCOVERY_REQUALIFIED = 15,
84
- GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING = 16,
85
- GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING = 17,
86
- THREAD_CREATED = 18,
87
- REPLY = 19,
88
- CHAT_INPUT_COMMAND = 20,
89
- THREAD_STARTER_MESSAGE = 21,
90
- GUILD_INVITE_REMINDER = 22,
91
- CONTEXT_MENU_COMMAND = 23
92
- }
93
- /** https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure */
94
- export interface MessageActivity {
95
- /** type of message activity */
96
- type: integer;
97
- /** party_id from a Rich Presence event */
98
- party_id?: string;
99
- }
100
- /** https://discord.com/developers/docs/resources/channel#message-object-message-activity-types */
101
- export declare enum MessageActivityType {
102
- JOIN = 1,
103
- SPECTATE = 2,
104
- LISTEN = 3,
105
- JOIN_REQUEST = 5
106
- }
107
- /** https://discord.com/developers/docs/resources/channel#message-object-message-flags */
108
- export declare enum MessageFlag {
109
- /** this message has been published to subscribed channels (via Channel Following) */
110
- CROSSPOSTED = 1,
111
- /** this message originated from a message in another channel (via Channel Following) */
112
- IS_CROSSPOST = 2,
113
- /** do not include any embeds when serializing this message */
114
- SUPPRESS_EMBEDS = 4,
115
- /** the source message for this crosspost has been deleted (via Channel Following) */
116
- SOURCE_MESSAGE_DELETED = 8,
117
- /** this message came from the urgent message system */
118
- URGENT = 16,
119
- /** this message has an associated thread, with the same id as the message */
120
- HAS_THREAD = 32,
121
- /** this message is only visible to the user who invoked the Interaction */
122
- EPHEMERAL = 64,
123
- /** this message is an Interaction Response and the bot is "thinking" */
124
- LOADING = 128
125
- }
126
- /** https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-structure */
127
- export interface MessageReference {
128
- /** id of the originating message */
129
- message_id?: snowflake;
130
- /** id of the originating message's channel */
131
- channel_id?: snowflake;
132
- /** id of the originating message's guild */
133
- guild_id?: snowflake;
134
- /** when sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default true */
135
- fail_if_not_exists?: boolean;
65
+ export declare namespace Message {
66
+ /** https://discord.com/developers/docs/resources/channel#message-object-message-types */
67
+ enum Type {
68
+ DEFAULT = 0,
69
+ RECIPIENT_ADD = 1,
70
+ RECIPIENT_REMOVE = 2,
71
+ CALL = 3,
72
+ CHANNEL_NAME_CHANGE = 4,
73
+ CHANNEL_ICON_CHANGE = 5,
74
+ CHANNEL_PINNED_MESSAGE = 6,
75
+ GUILD_MEMBER_JOIN = 7,
76
+ USER_PREMIUM_GUILD_SUBSCRIPTION = 8,
77
+ USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1 = 9,
78
+ USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = 10,
79
+ USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = 11,
80
+ CHANNEL_FOLLOW_ADD = 12,
81
+ GUILD_DISCOVERY_DISQUALIFIED = 14,
82
+ GUILD_DISCOVERY_REQUALIFIED = 15,
83
+ GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING = 16,
84
+ GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING = 17,
85
+ THREAD_CREATED = 18,
86
+ REPLY = 19,
87
+ CHAT_INPUT_COMMAND = 20,
88
+ THREAD_STARTER_MESSAGE = 21,
89
+ GUILD_INVITE_REMINDER = 22,
90
+ CONTEXT_MENU_COMMAND = 23
91
+ }
92
+ /** https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure */
93
+ interface Activity {
94
+ /** type of message activity */
95
+ type: ActivityType;
96
+ /** party_id from a Rich Presence event */
97
+ party_id?: string;
98
+ }
99
+ /** https://discord.com/developers/docs/resources/channel#message-object-message-activity-types */
100
+ enum ActivityType {
101
+ JOIN = 1,
102
+ SPECTATE = 2,
103
+ LISTEN = 3,
104
+ JOIN_REQUEST = 5
105
+ }
106
+ /** https://discord.com/developers/docs/resources/channel#message-object-message-flags */
107
+ enum Flag {
108
+ /** this message has been published to subscribed channels (via Channel Following) */
109
+ CROSSPOSTED = 1,
110
+ /** this message originated from a message in another channel (via Channel Following) */
111
+ IS_CROSSPOST = 2,
112
+ /** do not include any embeds when serializing this message */
113
+ SUPPRESS_EMBEDS = 4,
114
+ /** the source message for this crosspost has been deleted (via Channel Following) */
115
+ SOURCE_MESSAGE_DELETED = 8,
116
+ /** this message came from the urgent message system */
117
+ URGENT = 16,
118
+ /** this message has an associated thread, with the same id as the message */
119
+ HAS_THREAD = 32,
120
+ /** this message is only visible to the user who invoked the Interaction */
121
+ EPHEMERAL = 64,
122
+ /** this message is an Interaction Response and the bot is "thinking" */
123
+ LOADING = 128
124
+ }
125
+ /** https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-structure */
126
+ interface Reference {
127
+ /** id of the originating message */
128
+ message_id?: snowflake;
129
+ /** id of the originating message's channel */
130
+ channel_id?: snowflake;
131
+ /** id of the originating message's guild */
132
+ guild_id?: snowflake;
133
+ /** when sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default true */
134
+ fail_if_not_exists?: boolean;
135
+ }
136
+ /** https://discord.com/developers/docs/resources/channel#get-channel-messages-query-string-params */
137
+ interface GetParams {
138
+ /** get messages around this message ID */
139
+ around: snowflake;
140
+ /** get messages before this message ID */
141
+ before: snowflake;
142
+ /** get messages after this message ID */
143
+ after: snowflake;
144
+ /** max number of messages to return (1-100) */
145
+ limit: integer;
146
+ }
147
+ /** https://discord.com/developers/docs/resources/channel#create-message-jsonform-params */
148
+ interface CreateParams extends EditParams {
149
+ /** true if this is a TTS message */
150
+ tts: boolean;
151
+ /** include to make your message a reply */
152
+ message_reference: Reference;
153
+ /** IDs of up to 3 stickers in the server to send in the message */
154
+ sticker_ids: snowflake[];
155
+ }
156
+ /** https://discord.com/developers/docs/resources/channel#edit-message-jsonform-params */
157
+ interface EditParams {
158
+ /** the message contents (up to 2000 characters) */
159
+ content?: string;
160
+ /** embedded rich content (up to 6000 characters) */
161
+ embeds?: Embed[];
162
+ /** edit the flags of a message (only SUPPRESS_EMBEDS can currently be set/unset) */
163
+ flags?: integer;
164
+ /** allowed mentions for the message */
165
+ allowed_mentions?: AllowedMentions;
166
+ /** the components to include with the message */
167
+ components?: Component[];
168
+ /** the contents of the file being sent/edited */
169
+ files?: any;
170
+ /** JSON encoded body of non-file params (multipart/form-data only) */
171
+ payload_json?: string;
172
+ /** attached files to keep and possible descriptions for new files */
173
+ attachments?: Attachment[];
174
+ }
175
+ /** https://discord.com/developers/docs/resources/channel#bulk-delete-messages-json-params */
176
+ interface BulkDeleteParams {
177
+ /** an array of message ids to delete (2-100) */
178
+ messages: snowflake[];
179
+ }
136
180
  }
137
181
  /** https://discord.com/developers/docs/resources/channel#embed-object-embed-structure */
138
182
  export interface Embed {
@@ -149,88 +193,90 @@ export interface Embed {
149
193
  /** color code of the embed */
150
194
  color?: integer;
151
195
  /** footer information */
152
- footer?: EmbedFooter;
196
+ footer?: Embed.Footer;
153
197
  /** image information */
154
- image?: EmbedImage;
198
+ image?: Embed.Image;
155
199
  /** thumbnail information */
156
- thumbnail?: EmbedThumbnail;
200
+ thumbnail?: Embed.Thumbnail;
157
201
  /** video information */
158
- video?: EmbedVideo;
202
+ video?: Embed.Video;
159
203
  /** provider information */
160
- provider?: EmbedProvider;
204
+ provider?: Embed.Provider;
161
205
  /** author information */
162
- author?: EmbedAuthor;
206
+ author?: Embed.Author;
163
207
  /** fields information */
164
- fields?: EmbedField[];
165
- }
166
- /** https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure */
167
- export interface EmbedThumbnail {
168
- /** source url of thumbnail (only supports http(s) and attachments) */
169
- url: string;
170
- /** a proxied url of the thumbnail */
171
- proxy_url?: string;
172
- /** height of thumbnail */
173
- height?: integer;
174
- /** width of thumbnail */
175
- width?: integer;
176
- }
177
- /** https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure */
178
- export interface EmbedVideo {
179
- /** source url of video */
180
- url?: string;
181
- /** a proxied url of the video */
182
- proxy_url?: string;
183
- /** height of video */
184
- height?: integer;
185
- /** width of video */
186
- width?: integer;
208
+ fields?: Embed.Field[];
187
209
  }
188
- /** https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure */
189
- export interface EmbedImage {
190
- /** source url of image (only supports http(s) and attachments) */
191
- url: string;
192
- /** a proxied url of the image */
193
- proxy_url?: string;
194
- /** height of image */
195
- height?: integer;
196
- /** width of image */
197
- width?: integer;
198
- }
199
- /** https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure */
200
- export interface EmbedProvider {
201
- /** name of provider */
202
- name?: string;
203
- /** url of provider */
204
- url?: string;
205
- }
206
- /** https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure */
207
- export interface EmbedAuthor {
208
- /** name of author */
209
- name: string;
210
- /** url of author */
211
- url?: string;
212
- /** url of author icon (only supports http(s) and attachments) */
213
- icon_url?: string;
214
- /** a proxied url of author icon */
215
- proxy_icon_url?: string;
216
- }
217
- /** https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure */
218
- export interface EmbedFooter {
219
- /** footer text */
220
- text: string;
221
- /** url of footer icon (only supports http(s) and attachments) */
222
- icon_url?: string;
223
- /** a proxied url of footer icon */
224
- proxy_icon_url?: string;
225
- }
226
- /** https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure */
227
- export interface EmbedField {
228
- /** name of the field */
229
- name: string;
230
- /** value of the field */
231
- value: string;
232
- /** whether or not this field should display inline */
233
- inline?: boolean;
210
+ export declare namespace Embed {
211
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure */
212
+ interface Thumbnail {
213
+ /** source url of thumbnail (only supports http(s) and attachments) */
214
+ url: string;
215
+ /** a proxied url of the thumbnail */
216
+ proxy_url?: string;
217
+ /** height of thumbnail */
218
+ height?: integer;
219
+ /** width of thumbnail */
220
+ width?: integer;
221
+ }
222
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure */
223
+ interface Video {
224
+ /** source url of video */
225
+ url?: string;
226
+ /** a proxied url of the video */
227
+ proxy_url?: string;
228
+ /** height of video */
229
+ height?: integer;
230
+ /** width of video */
231
+ width?: integer;
232
+ }
233
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure */
234
+ interface Image {
235
+ /** source url of image (only supports http(s) and attachments) */
236
+ url: string;
237
+ /** a proxied url of the image */
238
+ proxy_url?: string;
239
+ /** height of image */
240
+ height?: integer;
241
+ /** width of image */
242
+ width?: integer;
243
+ }
244
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure */
245
+ interface Provider {
246
+ /** name of provider */
247
+ name?: string;
248
+ /** url of provider */
249
+ url?: string;
250
+ }
251
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure */
252
+ interface Author {
253
+ /** name of author */
254
+ name: string;
255
+ /** url of author */
256
+ url?: string;
257
+ /** url of author icon (only supports http(s) and attachments) */
258
+ icon_url?: string;
259
+ /** a proxied url of author icon */
260
+ proxy_icon_url?: string;
261
+ }
262
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure */
263
+ interface Footer {
264
+ /** footer text */
265
+ text: string;
266
+ /** url of footer icon (only supports http(s) and attachments) */
267
+ icon_url?: string;
268
+ /** a proxied url of footer icon */
269
+ proxy_icon_url?: string;
270
+ }
271
+ /** https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure */
272
+ interface Field {
273
+ /** name of the field */
274
+ name: string;
275
+ /** value of the field */
276
+ value: string;
277
+ /** whether or not this field should display inline */
278
+ inline?: boolean;
279
+ }
234
280
  }
235
281
  /** https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure */
236
282
  export interface Attachment {
@@ -260,59 +306,99 @@ export interface ChannelMention {
260
306
  /** id of the guild containing the channel */
261
307
  guild_id: snowflake;
262
308
  /** the type of channel */
263
- type: ChannelType;
309
+ type: Channel.Type;
264
310
  /** the name of the channel */
265
311
  name: string;
266
312
  }
267
- export interface MessageCreateEvent extends Message {
268
- }
269
- export interface MessageUpdateEvent extends Message {
270
- }
271
- /** https://discord.com/developers/docs/topics/gateway#message-delete-message-delete-event-fields */
272
- export interface MessageDeleteEvent {
273
- /** the id of the message */
274
- id: snowflake;
275
- /** the id of the channel */
276
- channel_id: snowflake;
277
- /** the id of the guild */
278
- guild_id?: snowflake;
279
- }
280
- /** https://discord.com/developers/docs/topics/gateway#message-delete-bulk-message-delete-bulk-event-fields */
281
- export interface MessageDeleteBulkEvent {
282
- /** the ids of the messages */
283
- ids: snowflake[];
284
- /** the id of the channel */
285
- channel_id: snowflake;
286
- /** the id of the guild */
287
- guild_id?: snowflake;
313
+ export declare namespace Message {
314
+ namespace Event {
315
+ interface Create extends Message {
316
+ }
317
+ interface Update extends Message {
318
+ }
319
+ /** https://discord.com/developers/docs/topics/gateway#message-delete-message-delete-event-fields */
320
+ interface Delete {
321
+ /** the id of the message */
322
+ id: snowflake;
323
+ /** the id of the channel */
324
+ channel_id: snowflake;
325
+ /** the id of the guild */
326
+ guild_id?: snowflake;
327
+ }
328
+ /** https://discord.com/developers/docs/topics/gateway#message-delete-bulk-message-delete-bulk-event-fields */
329
+ interface DeleteBulk {
330
+ /** the ids of the messages */
331
+ ids: snowflake[];
332
+ /** the id of the channel */
333
+ channel_id: snowflake;
334
+ /** the id of the guild */
335
+ guild_id?: snowflake;
336
+ }
337
+ }
288
338
  }
289
339
  declare module './gateway' {
290
340
  interface GatewayEvents {
291
341
  /** message was created */
292
- MESSAGE_CREATE: MessageCreateEvent;
342
+ MESSAGE_CREATE: Message.Event.Create;
293
343
  /** message was edited */
294
- MESSAGE_UPDATE: MessageUpdateEvent;
344
+ MESSAGE_UPDATE: Message.Event.Update;
295
345
  /** message was deleted */
296
- MESSAGE_DELETE: MessageDeleteEvent;
346
+ MESSAGE_DELETE: Message.Event.Delete;
297
347
  /** multiple messages were deleted at once */
298
- MESSAGE_DELETE_BULK: MessageDeleteBulkEvent;
348
+ MESSAGE_DELETE_BULK: Message.Event.DeleteBulk;
299
349
  }
300
350
  }
301
351
  declare module './internal' {
302
352
  interface Internal {
303
- /** https://discord.com/developers/docs/resources/channel#get-channel-messages */
304
- getChannelMessages(channel_id: snowflake): Promise<Message[]>;
305
- /** https://discord.com/developers/docs/resources/channel#get-channel-message */
353
+ /**
354
+ * Returns the messages for a channel. If operating on a guild channel, this endpoint requires the VIEW_CHANNEL permission to be present on the current user. If the current user is missing the 'READ_MESSAGE_HISTORY' permission in the channel then this will return no messages (since they cannot read the message history). Returns an array of message objects on success.
355
+ * @see https://discord.com/developers/docs/resources/channel#get-channel-messages
356
+ */
357
+ getChannelMessages(channel_id: snowflake, params?: Message.GetParams): Promise<Message[]>;
358
+ /**
359
+ * Returns a specific message in the channel. If operating on a guild channel, this endpoint requires the 'READ_MESSAGE_HISTORY' permission to be present on the current user. Returns a message object on success.
360
+ * @see https://discord.com/developers/docs/resources/channel#get-channel-message
361
+ */
306
362
  getChannelMessage(channel_id: snowflake, message_id: snowflake): Promise<Message>;
307
- /** https://discord.com/developers/docs/resources/channel#create-message */
308
- createMessage(channel_id: snowflake, data: Partial<Message>): Promise<Message>;
309
- /** https://discord.com/developers/docs/resources/channel#crosspost-message */
363
+ /**
364
+ * Post a message to a guild text or DM channel. Returns a message object. Fires a Message Create Gateway event. See message formatting for more information on how to properly format messages.
365
+ * @see https://discord.com/developers/docs/resources/channel#create-message
366
+ */
367
+ createMessage(channel_id: snowflake, params: Message.CreateParams): Promise<Message>;
368
+ /**
369
+ * Crosspost a message in a News Channel to following channels. This endpoint requires the 'SEND_MESSAGES' permission, if the current user sent the message, or additionally the 'MANAGE_MESSAGES' permission, for all other messages, to be present for the current user.
370
+ * @see https://discord.com/developers/docs/resources/channel#crosspost-message
371
+ */
310
372
  crosspostMessage(channel_id: snowflake, message_id: snowflake): Promise<Message>;
311
- /** https://discord.com/developers/docs/resources/channel#edit-message */
312
- editMessage(channel_id: snowflake, message_id: snowflake, data: Partial<Message>): Promise<Message>;
313
- /** https://discord.com/developers/docs/resources/channel#delete-message */
373
+ /**
374
+ * Edit a previously sent message. The fields content, embeds, and flags can be edited by the original message author. Other users can only edit flags and only if they have the MANAGE_MESSAGES permission in the corresponding channel. When specifying flags, ensure to include all previously set flags/bits in addition to ones that you are modifying. Only flags documented in the table below may be modified by users (unsupported flag changes are currently ignored without error).
375
+ * @see https://discord.com/developers/docs/resources/channel#edit-message
376
+ */
377
+ editMessage(channel_id: snowflake, message_id: snowflake, params: Message.EditParams): Promise<Message>;
378
+ /**
379
+ * Delete a message. If operating on a guild channel and trying to delete a message that was not sent by the current user, this endpoint requires the MANAGE_MESSAGES permission. Returns a 204 empty response on success. Fires a Message Delete Gateway event.
380
+ * @see https://discord.com/developers/docs/resources/channel#delete-message
381
+ */
314
382
  deleteMessage(channel_id: snowflake, message_id: snowflake): Promise<void>;
315
- /** https://discord.com/developers/docs/resources/channel#bulk-delete-messages */
316
- bulkDeleteMessages(channel_id: snowflake, message_ids: snowflake[]): Promise<void>;
383
+ /**
384
+ * Delete multiple messages in a single request. This endpoint can only be used on guild channels and requires the MANAGE_MESSAGES permission. Returns a 204 empty response on success. Fires a Message Delete Bulk Gateway event.
385
+ * @see https://discord.com/developers/docs/resources/channel#bulk-delete-messages
386
+ */
387
+ bulkDeleteMessages(channel_id: snowflake, params: Message.BulkDeleteParams): Promise<void>;
388
+ /**
389
+ * Returns all pinned messages in the channel as an array of message objects.
390
+ * @see https://discord.com/developers/docs/resources/channel#get-pinned-messages
391
+ */
392
+ getPinnedMessages(channel_id: snowflake): Promise<Message[]>;
393
+ /**
394
+ * Pin a message in a channel. Requires the MANAGE_MESSAGES permission. Returns a 204 empty response on success.
395
+ * @see https://discord.com/developers/docs/resources/channel#pin-message
396
+ */
397
+ pinMessage(channel_id: snowflake, message_id: snowflake): Promise<void>;
398
+ /**
399
+ * Unpin a message in a channel. Requires the MANAGE_MESSAGES permission. Returns a 204 empty response on success.
400
+ * @see https://discord.com/developers/docs/resources/channel#unpin-message
401
+ */
402
+ unpinMessage(channel_id: snowflake, message_id: snowflake): Promise<void>;
317
403
  }
318
404
  }
@@ -0,0 +1,114 @@
1
+ import { Emoji, GuildMember, integer, snowflake } from '.';
2
+ /** https://discord.com/developers/docs/resources/channel#reaction-object-reaction-structure */
3
+ export interface Reaction {
4
+ /** times this emoji has been used to react */
5
+ count: integer;
6
+ /** whether the current user reacted using this emoji */
7
+ me: boolean;
8
+ /** emoji information */
9
+ emoji: Partial<Emoji>;
10
+ }
11
+ export declare namespace Reaction {
12
+ namespace Event {
13
+ /** https://discord.com/developers/docs/topics/gateway#message-reaction-add-message-reaction-add-event-fields */
14
+ interface Add {
15
+ /** the id of the user */
16
+ user_id: snowflake;
17
+ /** the id of the channel */
18
+ channel_id: snowflake;
19
+ /** the id of the message */
20
+ message_id: snowflake;
21
+ /** the id of the guild */
22
+ guild_id?: snowflake;
23
+ /** the member who reacted if this happened in a guild */
24
+ member?: GuildMember;
25
+ /** the emoji used to react - example */
26
+ emoji: Partial<Emoji>;
27
+ }
28
+ /** https://discord.com/developers/docs/topics/gateway#message-reaction-remove-message-reaction-remove-event-fields */
29
+ interface Remove {
30
+ /** the id of the user */
31
+ user_id: snowflake;
32
+ /** the id of the channel */
33
+ channel_id: snowflake;
34
+ /** the id of the message */
35
+ message_id: snowflake;
36
+ /** the id of the guild */
37
+ guild_id?: snowflake;
38
+ /** the emoji used to react - example */
39
+ emoji: Partial<Emoji>;
40
+ }
41
+ /** https://discord.com/developers/docs/topics/gateway#message-reaction-remove-all-message-reaction-remove-all-event-fields */
42
+ interface RemoveAll {
43
+ /** the id of the channel */
44
+ channel_id: snowflake;
45
+ /** the id of the message */
46
+ message_id: snowflake;
47
+ /** the id of the guild */
48
+ guild_id?: snowflake;
49
+ }
50
+ /** https://discord.com/developers/docs/topics/gateway#message-reaction-remove-emoji-message-reaction-remove-emoji */
51
+ interface RemoveEmoji {
52
+ /** the id of the channel */
53
+ channel_id: snowflake;
54
+ /** the id of the guild */
55
+ guild_id?: snowflake;
56
+ /** the id of the message */
57
+ message_id: snowflake;
58
+ /** the emoji that was removed */
59
+ emoji: Partial<Emoji>;
60
+ }
61
+ }
62
+ interface GetParams {
63
+ /** get users after this user ID */
64
+ after?: snowflake;
65
+ /** max number of users to return (1-100) */
66
+ limit?: integer;
67
+ }
68
+ }
69
+ declare module './gateway' {
70
+ interface GatewayEvents {
71
+ /** user reacted to a message */
72
+ MESSAGE_REACTION_ADD: Reaction.Event.Add;
73
+ /** user removed a reaction from a message */
74
+ MESSAGE_REACTION_REMOVE: Reaction.Event.Remove;
75
+ /** all reactions were explicitly removed from a message */
76
+ MESSAGE_REACTION_REMOVE_ALL: Reaction.Event.RemoveAll;
77
+ /** all reactions for a given emoji were explicitly removed from a message */
78
+ MESSAGE_REACTION_REMOVE_EMOJI: Reaction.Event.RemoveEmoji;
79
+ }
80
+ }
81
+ declare module './internal' {
82
+ interface Internal {
83
+ /**
84
+ * Create a reaction for the message. This endpoint requires the 'READ_MESSAGE_HISTORY' permission to be present on the current user. Additionally, if nobody else has reacted to the message using this emoji, this endpoint requires the 'ADD_REACTIONS' permission to be present on the current user. Returns a 204 empty response on success. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.
85
+ * @see https://discord.com/developers/docs/resources/channel#create-reaction
86
+ */
87
+ createReaction(channel_id: snowflake, message_id: snowflake, emoji: string): Promise<void>;
88
+ /**
89
+ * Delete a reaction the current user has made for the message. Returns a 204 empty response on success. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.
90
+ * @see https://discord.com/developers/docs/resources/channel#delete-own-reaction
91
+ */
92
+ deleteOwnReaction(channel_id: snowflake, message_id: snowflake, emoji: string): Promise<void>;
93
+ /**
94
+ * Deletes another user's reaction. This endpoint requires the 'MANAGE_MESSAGES' permission to be present on the current user. Returns a 204 empty response on success. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.
95
+ * @see https://discord.com/developers/docs/resources/channel#delete-user-reaction
96
+ */
97
+ deleteUserReaction(channel_id: snowflake, message_id: snowflake, emoji: string, user_id: snowflake): Promise<void>;
98
+ /**
99
+ * Get a list of users that reacted with this emoji. Returns an array of user objects on success. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.
100
+ * @see https://discord.com/developers/docs/resources/channel#get-reactions
101
+ */
102
+ getReactions(channel_id: snowflake, message_id: snowflake, emoji: string, params?: Reaction.GetParams): Promise<Reaction[]>;
103
+ /**
104
+ * Deletes all reactions on a message. This endpoint requires the 'MANAGE_MESSAGES' permission to be present on the current user. Fires a Message Reaction Remove All Gateway event.
105
+ * @see https://discord.com/developers/docs/resources/channel#delete-all-reactions
106
+ */
107
+ deleteAllReactions(channel_id: snowflake, message_id: snowflake): Promise<void>;
108
+ /**
109
+ * Deletes all the reactions for a given emoji on a message. This endpoint requires the MANAGE_MESSAGES permission to be present on the current user. Fires a Message Reaction Remove Emoji Gateway event. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.
110
+ * @see https://discord.com/developers/docs/resources/channel#delete-all-reactions-for-emoji
111
+ */
112
+ deleteAllReactionsForEmoji(channel_id: snowflake, message_id: snowflake, emoji: string): Promise<void>;
113
+ }
114
+ }