snowtransfer 0.18.0 → 0.18.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.
- package/CHANGELOG.md +29 -0
- package/dist/Constants.d.ts +59 -0
- package/dist/Constants.js +123 -0
- package/dist/Endpoints.d.ts +120 -0
- package/dist/Endpoints.js +121 -0
- package/dist/RequestHandler.d.ts +258 -0
- package/dist/RequestHandler.js +629 -0
- package/dist/SnowTransfer.d.ts +70 -0
- package/dist/SnowTransfer.js +105 -0
- package/dist/StateMachine.d.ts +89 -0
- package/dist/StateMachine.js +208 -0
- package/dist/StateMachineGraph.d.ts +3 -0
- package/dist/StateMachineGraph.js +23 -0
- package/dist/Types.d.ts +76 -0
- package/dist/Types.js +2 -0
- package/dist/index.d.ts +25 -718
- package/dist/index.js +63 -44
- package/dist/methods/Assets.d.ts +290 -0
- package/dist/methods/Assets.js +326 -0
- package/dist/methods/AuditLog.d.ts +40 -0
- package/dist/methods/AuditLog.js +44 -0
- package/dist/methods/AutoModeration.d.ts +122 -0
- package/dist/methods/AutoModeration.js +135 -0
- package/dist/methods/Bot.d.ts +65 -0
- package/dist/methods/Bot.js +75 -0
- package/dist/methods/Channel.d.ts +866 -0
- package/dist/methods/Channel.js +982 -0
- package/dist/methods/Entitlements.d.ts +87 -0
- package/dist/methods/Entitlements.js +99 -0
- package/dist/methods/Guild.d.ts +722 -0
- package/dist/methods/Guild.js +785 -0
- package/dist/methods/GuildScheduledEvent.d.ts +138 -0
- package/dist/methods/GuildScheduledEvent.js +155 -0
- package/dist/methods/GuildTemplate.d.ts +110 -0
- package/dist/methods/GuildTemplate.js +124 -0
- package/dist/methods/Interaction.d.ts +339 -0
- package/dist/methods/Interaction.js +359 -0
- package/dist/methods/Invite.d.ts +81 -0
- package/dist/methods/Invite.js +107 -0
- package/dist/methods/Sku.d.ts +58 -0
- package/dist/methods/Sku.js +66 -0
- package/dist/methods/StageInstance.d.ts +86 -0
- package/dist/methods/StageInstance.js +97 -0
- package/dist/methods/User.d.ts +167 -0
- package/dist/methods/User.js +184 -0
- package/dist/methods/Voice.d.ts +44 -0
- package/dist/methods/Voice.js +52 -0
- package/dist/methods/Webhook.d.ts +265 -0
- package/dist/methods/Webhook.js +256 -0
- package/dist/tokenless.d.ts +19 -0
- package/dist/tokenless.js +31 -0
- package/package.json +9 -9
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,866 @@
|
|
|
1
|
+
import type { RequestHandler } from "../RequestHandler";
|
|
2
|
+
import { type APITextBasedChannel, type APIThreadChannel, type ChannelType, type RESTDeleteAPIChannelAllMessageReactionsResult, type RESTDeleteAPIChannelMessageReactionResult, type RESTDeleteAPIChannelMessageOwnReactionResult, type RESTDeleteAPIChannelMessageResult, type RESTDeleteAPIChannelMessageUserReactionResult, type RESTDeleteAPIChannelPermissionResult, type RESTDeleteAPIChannelMessagesPinResult, type RESTDeleteAPIChannelResult, type RESTDeleteAPIChannelThreadMembersResult, type RESTGetAPIChannelInvitesResult, type RESTGetAPIChannelMessageReactionUsersQuery, type RESTGetAPIChannelMessageReactionUsersResult, type RESTGetAPIChannelMessageResult, type RESTGetAPIChannelMessagesQuery, type RESTGetAPIChannelMessagesResult, type RESTGetAPIChannelMessagesPinsResult, type RESTGetAPIChannelResult, type RESTGetAPIChannelThreadMemberResult, type RESTGetAPIChannelThreadMembersQuery, type RESTGetAPIChannelThreadMembersResult, type RESTGetAPIChannelThreadsArchivedPrivateResult, type RESTGetAPIChannelThreadsArchivedPublicResult, type RESTGetAPIChannelThreadsArchivedQuery, type RESTGetAPIChannelUsersThreadsArchivedResult, type RESTPatchAPIChannelJSONBody, type RESTPatchAPIChannelMessageJSONBody, type RESTPatchAPIChannelMessageResult, type RESTPatchAPIChannelResult, type RESTPostAPIChannelFollowersResult, type RESTPostAPIChannelInviteJSONBody, type RESTPostAPIChannelInviteResult, type RESTPostAPIChannelMessageCrosspostResult, type RESTPostAPIChannelMessageJSONBody, type RESTPostAPIChannelMessageResult, type RESTPostAPIChannelMessagesBulkDeleteResult, type RESTPostAPIChannelMessagesThreadsJSONBody, type RESTPostAPIChannelMessagesThreadsResult, type RESTPostAPIChannelThreadsJSONBody, type RESTPostAPIChannelTypingResult, type RESTPutAPIChannelMessageReactionResult, type RESTPutAPIChannelPermissionJSONBody, type RESTPutAPIChannelPermissionResult, type RESTPutAPIChannelMessagesPinResult, type RESTPutAPIChannelThreadMembersResult, type RESTGetAPIPollAnswerVotersQuery, type RESTGetAPIPollAnswerVotersResult, type RESTPostAPIPollExpireResult, type RESTGetAPIChannelMessagesPinsQuery, type APIGuildVoiceChannel, type RESTPutAPIChannelVoiceStatusResult } from "discord-api-types/v10";
|
|
3
|
+
import type { FileInput, RESTPostAPIAttachmentsRefreshURLsResult, SnowTransferOptions } from "../Types";
|
|
4
|
+
/**
|
|
5
|
+
* Methods for interacting with Channels and Messages
|
|
6
|
+
* @since 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
declare class ChannelMethods {
|
|
9
|
+
readonly requestHandler: RequestHandler;
|
|
10
|
+
options: SnowTransferOptions;
|
|
11
|
+
/**
|
|
12
|
+
* Create a new Channel Method handler
|
|
13
|
+
*
|
|
14
|
+
* Usually SnowTransfer creates a method handler for you, this is here for completion
|
|
15
|
+
*
|
|
16
|
+
* You can access the methods listed via `client.channel.method`, where `client` is an initialized SnowTransfer instance
|
|
17
|
+
* @param requestHandler request handler that calls the rest api
|
|
18
|
+
* @param options Options for the SnowTransfer instance
|
|
19
|
+
*/
|
|
20
|
+
constructor(requestHandler: RequestHandler, options: SnowTransferOptions);
|
|
21
|
+
/**
|
|
22
|
+
* Get a channel via Id
|
|
23
|
+
* @since 0.1.0
|
|
24
|
+
* @param channelId Id of the channel
|
|
25
|
+
* @returns [discord channel](https://discord.com/developers/docs/resources/channel#channel-object) object
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* const client = new SnowTransfer("TOKEN")
|
|
29
|
+
* const channel = await client.channel.getChannel("channel id")
|
|
30
|
+
*/
|
|
31
|
+
getChannel(channelId: string): Promise<RESTGetAPIChannelResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Update a guild channel or thread
|
|
34
|
+
* @since 0.18.0
|
|
35
|
+
* @param channelId Id of the guild channel
|
|
36
|
+
* @param data Data to update the channel with
|
|
37
|
+
* @param reason Reason for updating the channel
|
|
38
|
+
* @returns [discord channel](https://discord.com/developers/docs/resources/channel#channel-object) object
|
|
39
|
+
*
|
|
40
|
+
* | Permissions needed | Condition |
|
|
41
|
+
* |--------------------|-------------------------------------------------------------------------------------------------------------------------|
|
|
42
|
+
* | MANAGE_CHANNELS | always |
|
|
43
|
+
* | MANAGE_ROLES | If modifying permission overwrites |
|
|
44
|
+
* | SEND_MESSAGES | When editing a Thread to change the name, archived, auto_archive_duration, rate_limit_per_user or locked fields |
|
|
45
|
+
* | MANAGE_THREADS | When editing a Thread and not modifying the name, archived, auto_archive_duration, rate_limit_per_user or locked fields |
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // This example updates a channel with the passed id to use "New Name" as its name and "Look at this cool topic" as the topic
|
|
49
|
+
* const client = new SnowTransfer("TOKEN")
|
|
50
|
+
* const updateData = {
|
|
51
|
+
* name: "New Name",
|
|
52
|
+
* topic: "Look at this cool topic"
|
|
53
|
+
* }
|
|
54
|
+
* client.channel.editChannel("channel id", updateData)
|
|
55
|
+
*/
|
|
56
|
+
editChannel(channelId: string, data: Omit<RESTPatchAPIChannelJSONBody, "archived" | "auto_archive_duration" | "locked" | "invitable">, reason?: string): Promise<Exclude<RESTPatchAPIChannelResult, APIThreadChannel>>;
|
|
57
|
+
editChannel(channelId: string, data: Pick<RESTPatchAPIChannelJSONBody, "archived" | "auto_archive_duration" | "locked" | "name" | "rate_limit_per_user">, reason?: string): Promise<Extract<RESTPatchAPIChannelResult, APIThreadChannel>>;
|
|
58
|
+
/**
|
|
59
|
+
* Delete a channel or thread via Id
|
|
60
|
+
*
|
|
61
|
+
* This either **deletes** a Guild Channel/thread or **closes** a Direct Message Channel
|
|
62
|
+
*
|
|
63
|
+
* **Be careful with deleting Guild Channels as this cannot be undone!**
|
|
64
|
+
*
|
|
65
|
+
* When deleting a category, this does **not** delete the child channels of a category. They will just have their `parent_id` removed.
|
|
66
|
+
*
|
|
67
|
+
* For community guilds, the rules channel and the community updates channel cannot be deleted.
|
|
68
|
+
* @since 0.1.0
|
|
69
|
+
* @param channelId Id of the channel
|
|
70
|
+
* @param reason Reason for deleting the channel
|
|
71
|
+
* @returns [discord channel](https://discord.com/developers/docs/resources/channel#channel-object) object
|
|
72
|
+
*
|
|
73
|
+
* | Permissions needed | Condition |
|
|
74
|
+
* |--------------------|--------------------------------|
|
|
75
|
+
* | MANAGE_CHANNELS | if channel is not a DM channel |
|
|
76
|
+
* | MANAGE_THREADS | if channel is a thread |
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* // Deletes a channel via id because it wasn't needed anymore
|
|
80
|
+
* const client = new SnowTransfer("TOKEN")
|
|
81
|
+
* client.channel.deleteChannel("channel id", "No longer needed")
|
|
82
|
+
*/
|
|
83
|
+
deleteChannel(channelId: string, reason?: string): Promise<RESTDeleteAPIChannelResult>;
|
|
84
|
+
/**
|
|
85
|
+
* Get a list of messages from a channel
|
|
86
|
+
* @since 0.1.0
|
|
87
|
+
* @param channelId Id of the channel
|
|
88
|
+
* @param options Options for getting channel messages
|
|
89
|
+
* @returns Array of [discord message](https://discord.com/developers/docs/resources/channel#message-object) objects
|
|
90
|
+
*
|
|
91
|
+
* | Permissions needed | Condition |
|
|
92
|
+
* |----------------------|----------------------------------------------------------------------------------|
|
|
93
|
+
* | VIEW_CHANNEL | if channel is not a DM channel |
|
|
94
|
+
* | READ_MESSAGE_HISTORY | if channel is not a DM channel, unless you want the API to return an empty Array |
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* // Fetch the last 20 messages from a channel
|
|
98
|
+
* const client = new SnowTransfer("TOKEN")
|
|
99
|
+
* const options = {
|
|
100
|
+
* limit: 20
|
|
101
|
+
* }
|
|
102
|
+
* const messages = await client.channel.getChannelMessages("channel id", options)
|
|
103
|
+
*/
|
|
104
|
+
getChannelMessages(channelId: string, options?: RESTGetAPIChannelMessagesQuery): Promise<RESTGetAPIChannelMessagesResult>;
|
|
105
|
+
/**
|
|
106
|
+
* Get a single message via Id
|
|
107
|
+
* @since 0.1.0
|
|
108
|
+
* @param channelId Id of the channel
|
|
109
|
+
* @param messageId Id of the message
|
|
110
|
+
* @returns [discord message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
111
|
+
*
|
|
112
|
+
* | Permissions needed | Condition |
|
|
113
|
+
* |----------------------|--------------------------------|
|
|
114
|
+
* | VIEW_CHANNEL | if channel is not a DM channel |
|
|
115
|
+
* | READ_MESSAGE_HISTORY | if channel is not a DM channel |
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* // Get a single message from a channel via id
|
|
119
|
+
* const client = new SnowTransfer("TOKEN")
|
|
120
|
+
* const message = await client.channel.getChannelMessage("channel id", "message id")
|
|
121
|
+
*/
|
|
122
|
+
getChannelMessage(channelId: string, messageId: string): Promise<RESTGetAPIChannelMessageResult>;
|
|
123
|
+
/**
|
|
124
|
+
* Creates a new Message within a channel or thread
|
|
125
|
+
*
|
|
126
|
+
* **Make sure to use a filename with a proper extension (e.g. png, jpeg, etc.) when you want to upload files**
|
|
127
|
+
* @since 0.1.0
|
|
128
|
+
* @param channelId Id of the Channel or thread to send a message to
|
|
129
|
+
* @param data Data to send, if data is a string it will be used as the content of the message,
|
|
130
|
+
* if data is not a string you should take a look at the properties below to know what you may send
|
|
131
|
+
* @param options Options for sending this message
|
|
132
|
+
* @returns [discord message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
133
|
+
*
|
|
134
|
+
* | Permissions needed | Condition |
|
|
135
|
+
* |--------------------------|---------------------------------------------------------------|
|
|
136
|
+
* | VIEW_CHANNEL | if channel is not a DM channel |
|
|
137
|
+
* | READ_MESSAGE_HISTORY | if channel is not a DM channel and message is a reply |
|
|
138
|
+
* | SEND_MESSAGES | if channel is not a DM channel and if channel is not a thread |
|
|
139
|
+
* | SEND_TTS_MESSAGES | if channel is not a DM channel and tts is set to true |
|
|
140
|
+
* | SEND_MESSAGES_IN_THREADS | if channel is a thread |
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* // Make a bot say "hi" within a channel
|
|
144
|
+
* // createMessage sends the passed data as content, when you give it a string
|
|
145
|
+
* const client = new SnowTransfer("TOKEN")
|
|
146
|
+
* client.channel.createMessage("channel id", "hi")
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* // Send a rich embed object
|
|
150
|
+
* const client = new SnowTransfer("TOKEN")
|
|
151
|
+
* const embedData = {
|
|
152
|
+
* title: "This is a nice embed",
|
|
153
|
+
* description: "But winter is so cold",
|
|
154
|
+
* fields: [
|
|
155
|
+
* { name: "Brr", value: "Insert snowflake emoji here" }
|
|
156
|
+
* ]
|
|
157
|
+
* }
|
|
158
|
+
* client.channel.createMessage("channel id", { embeds: [embedData] })
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* // Send a file with a comment
|
|
162
|
+
* const client = new SnowTransfer("TOKEN")
|
|
163
|
+
* // fileData will be a buffer with the data of the png image.
|
|
164
|
+
* const fileData = fs.readFileSync("nice_picture.png") // You should probably use fs.promises.readFile, since it is asynchronous, synchronous methods block the thread.
|
|
165
|
+
* client.channel.createMessage("channel id", { content: "This is a nice picture", files: [{ name: "Optional_Filename.png", file: fileData }] })
|
|
166
|
+
*/
|
|
167
|
+
createMessage(channelId: string, data: string | RESTPostAPIChannelMessageJSONBody & {
|
|
168
|
+
files?: Array<{
|
|
169
|
+
name: string;
|
|
170
|
+
file: FileInput;
|
|
171
|
+
}>;
|
|
172
|
+
}): Promise<RESTPostAPIChannelMessageResult>;
|
|
173
|
+
/**
|
|
174
|
+
* Creates a new voice Message within a channel or thread
|
|
175
|
+
* @since 0.10.0
|
|
176
|
+
* @param channelId Id of the Channel or thread to send a message to
|
|
177
|
+
* @param data Buffer of the audio file to send. Tested file types are ogg, mp3, m4a, wav, flac. Other file types work, but some can only be embedded on mobile. Try it and see:tm:
|
|
178
|
+
* @param audioDurationSeconds The duration of the audio file in seconds
|
|
179
|
+
* @param waveform A preview of the entire voice message, with 1 byte per datapoint encoded in base64.
|
|
180
|
+
* Official clients sample the recording at most once per 100 milliseconds, but will downsample so that no more than 256 datapoints are in the waveform.
|
|
181
|
+
* If you have no clue what you're doing or don't want to mess with audio processing, leave this as an empty string (default).
|
|
182
|
+
* Refer to Constants.generateWaveform for guidance on computing it yourself.
|
|
183
|
+
* @returns non editable [discord message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
184
|
+
*
|
|
185
|
+
* | Permissions needed | Condition |
|
|
186
|
+
* |--------------------------|---------------------------------------------------------------|
|
|
187
|
+
* | VIEW_CHANNEL | if channel is not a DM channel |
|
|
188
|
+
* | READ_MESSAGE_HISTORY | if channel is not a DM channel and message is a reply |
|
|
189
|
+
* | SEND_MESSAGES | if channel is not a DM channel and if channel is not a thread |
|
|
190
|
+
* | SEND_MESSAGES_IN_THREADS | if channel is a thread |
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* // Send a voice message that has a duration of 6 seconds
|
|
194
|
+
* const client = new SnowTransfer("TOKEN")
|
|
195
|
+
* // fileData will be a buffer with the data of the ogg audio
|
|
196
|
+
* const fileData = fs.readFileSync("6-second-long-audio.ogg") // You should probably use fs.promises.readFile, since it is asynchronous, synchronous methods block the thread.
|
|
197
|
+
* client.channel.createVoiceMessage("channel id", fileData, 6)
|
|
198
|
+
*/
|
|
199
|
+
createVoiceMessage(channelId: string, data: Buffer, audioDurationSeconds: number, waveform?: string): Promise<RESTPostAPIChannelMessageResult>;
|
|
200
|
+
/**
|
|
201
|
+
* Crosspost a message in a news channel to all following channels
|
|
202
|
+
* @since 0.3.0
|
|
203
|
+
* @param channelId Id of the news channel
|
|
204
|
+
* @param messageId Id of the message
|
|
205
|
+
* @returns [discord message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
206
|
+
*
|
|
207
|
+
* | Permissions needed | Condition |
|
|
208
|
+
* |--------------------|------------------------------------------------|
|
|
209
|
+
* | VIEW_CHANNEL | always |
|
|
210
|
+
* | SEND_MESSAGES | if the message was sent by the current user |
|
|
211
|
+
* | MANAGE_MESSAGES | if the message wasn't sent by the current user |
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* // Crosspost a message
|
|
215
|
+
* const client = new SnowTransfer("TOKEN")
|
|
216
|
+
* client.channel.crosspostMessage("channel id", "message id")
|
|
217
|
+
*/
|
|
218
|
+
crosspostMessage(channelId: string, messageId: string): Promise<RESTPostAPIChannelMessageCrosspostResult>;
|
|
219
|
+
/**
|
|
220
|
+
* Adds a reaction to a message
|
|
221
|
+
* @since 0.1.0
|
|
222
|
+
* @param channelId Id of the channel
|
|
223
|
+
* @param messageId Id of the message
|
|
224
|
+
* @param emoji uri encoded reaction emoji to add
|
|
225
|
+
* you may either use a discord emoji in the format `:emoji_name:emoji_id` or a unicode emoji,
|
|
226
|
+
* which can be found [here](http://www.unicode.org/emoji/charts/full-emoji-list.html)
|
|
227
|
+
* @returns Resolves the Promise on successful execution
|
|
228
|
+
*
|
|
229
|
+
* | Permissions needed | Condition |
|
|
230
|
+
* |----------------------|------------------------------------------------------------------------------------|
|
|
231
|
+
* | VIEW_CHANNEL | if channel is not a DM channel |
|
|
232
|
+
* | READ_MESSAGE_HISTORY | if channel is not a DM channel |
|
|
233
|
+
* | ADD_REACTIONS | When no other user has reacted with the emoji used and channel is not a DM channel |
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* // This example uses a discord emoji
|
|
237
|
+
* const client = new SnowTransfer("TOKEN")
|
|
238
|
+
* client.channel.createReaction("channel Id", "message Id", encodeURIComponent("awooo:322522663304036352"))
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* // using a utf-8 emoji
|
|
242
|
+
* const client = new SnowTransfer("TOKEN")
|
|
243
|
+
* client.channel.createReaction("channel Id", "message Id", encodeURIComponent("😀"))
|
|
244
|
+
*/
|
|
245
|
+
createReaction(channelId: string, messageId: string, emoji: string): Promise<RESTPutAPIChannelMessageReactionResult>;
|
|
246
|
+
/**
|
|
247
|
+
* Delete a reaction added by the current user from a message
|
|
248
|
+
* @since 0.1.0
|
|
249
|
+
* @param channelId Id of the channel
|
|
250
|
+
* @param messageId Id of the message
|
|
251
|
+
* @param emoji reaction emoji
|
|
252
|
+
* @returns Resolves the Promise on successful execution
|
|
253
|
+
*
|
|
254
|
+
* | Permission | Condition |
|
|
255
|
+
* |----------------------|--------------------------------|
|
|
256
|
+
* | VIEW_CHANNEL | if channel is not a DM channel |
|
|
257
|
+
* | READ_MESSAGE_HISTORY | if channel is not a DM channel |
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* // This example uses a discord emoji
|
|
261
|
+
* const client = new SnowTransfer("TOKEN")
|
|
262
|
+
* client.channel.deleteReactionSelf("channel Id", "message Id", encodeURIComponent("awooo:322522663304036352"))
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* // using a utf-8 emoji
|
|
266
|
+
* const client = new SnowTransfer("TOKEN")
|
|
267
|
+
* client.channel.deleteReactionSelf("channel Id", "message Id", encodeURIComponent("😀"))
|
|
268
|
+
*/
|
|
269
|
+
deleteReactionSelf(channelId: string, messageId: string, emoji: string): Promise<RESTDeleteAPIChannelMessageOwnReactionResult>;
|
|
270
|
+
/**
|
|
271
|
+
* Delete a reaction from a message in a guild channel
|
|
272
|
+
* @since 0.1.0
|
|
273
|
+
* @param channelId Id of the guild channel
|
|
274
|
+
* @param messageId Id of the message
|
|
275
|
+
* @param emoji reaction emoji
|
|
276
|
+
* @param userId Id of the user
|
|
277
|
+
* @returns Resolves the Promise on successful execution
|
|
278
|
+
*
|
|
279
|
+
* | Permission | Condition |
|
|
280
|
+
* |----------------------|-----------|
|
|
281
|
+
* | MANAGE_MESSAGES | always |
|
|
282
|
+
* | VIEW_CHANNEL | always |
|
|
283
|
+
* | READ_MESSAGE_HISTORY | always |
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* // This example uses a discord emoji
|
|
287
|
+
* const client = new SnowTransfer("TOKEN")
|
|
288
|
+
* client.channel.deleteReaction("channel Id", "message Id", encodeURIComponent("awooo:322522663304036352"), "user Id")
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* // using a utf-8 emoji
|
|
292
|
+
* const client = new SnowTransfer("TOKEN")
|
|
293
|
+
* // If a user Id is not supplied, the emoji from that message will be removed for all users
|
|
294
|
+
* client.channel.deleteReaction("channel Id", "message Id", encodeURIComponent("😀"))
|
|
295
|
+
*/
|
|
296
|
+
deleteReaction(channelId: string, messageId: string, emoji: string, userId?: string): Promise<RESTDeleteAPIChannelMessageUserReactionResult | RESTDeleteAPIChannelMessageReactionResult>;
|
|
297
|
+
/**
|
|
298
|
+
* Get a list of users that reacted with a certain emoji on a certain message
|
|
299
|
+
* @since 0.1.0
|
|
300
|
+
* @param channelId Id of the channel
|
|
301
|
+
* @param messageId Id of the message
|
|
302
|
+
* @param emoji reaction emoji
|
|
303
|
+
* @param options Options for getting users
|
|
304
|
+
* @returns Array of [user objects](https://discord.com/developers/docs/resources/user#user-object)
|
|
305
|
+
*
|
|
306
|
+
* | Permissions needed | Condition |
|
|
307
|
+
* |----------------------|--------------------------------|
|
|
308
|
+
* | VIEW_CHANNEL | if channel is not a DM channel |
|
|
309
|
+
* | READ_MESSAGE_HISTORY | if channel is not a DM channel |
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* // This example uses a discord emoji
|
|
313
|
+
* const client = new SnowTransfer("TOKEN")
|
|
314
|
+
* const reactions = await client.channel.getReactions("channel Id", "message Id", encodeURIComponent("awooo:322522663304036352"))
|
|
315
|
+
*/
|
|
316
|
+
getReactions(channelId: string, messageId: string, emoji: string, options?: RESTGetAPIChannelMessageReactionUsersQuery): Promise<RESTGetAPIChannelMessageReactionUsersResult>;
|
|
317
|
+
/**
|
|
318
|
+
* Delete all reactions from a message in a guild channel
|
|
319
|
+
* @since 0.1.0
|
|
320
|
+
* @param channelId Id of the guild channel
|
|
321
|
+
* @param messageId Id of the message
|
|
322
|
+
* @returns Resolves the Promise on successful execution
|
|
323
|
+
*
|
|
324
|
+
* | Permissions needed | Condition |
|
|
325
|
+
* |----------------------|-----------|
|
|
326
|
+
* | VIEW_CHANNEL | always |
|
|
327
|
+
* | READ_MESSAGE_HISTORY | always |
|
|
328
|
+
* | MANAGE_MESSAGES | always |
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* const client = new SnowTransfer("TOKEN")
|
|
332
|
+
* client.channel.deleteAllReactions("channel Id", "message Id")
|
|
333
|
+
*/
|
|
334
|
+
deleteAllReactions(channelId: string, messageId: string): Promise<RESTDeleteAPIChannelAllMessageReactionsResult>;
|
|
335
|
+
/**
|
|
336
|
+
* Edit a message sent by the current user or edit the message flags of another user's message
|
|
337
|
+
* @since 0.1.0
|
|
338
|
+
* @param channelId Id of the channel
|
|
339
|
+
* @param messageId Id of the message
|
|
340
|
+
* @param data Data to send
|
|
341
|
+
* @param options Options for editing this message
|
|
342
|
+
* @returns [discord message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
343
|
+
*
|
|
344
|
+
* | Permissions needed | Condition |
|
|
345
|
+
* |--------------------|--------------------------------------------------|
|
|
346
|
+
* | VIEW_CHANNEL | if channel is not a DM channel |
|
|
347
|
+
* | MANAGE_MESSAGES | When editing someone else's message to set flags |
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* // Simple ping response
|
|
351
|
+
* const client = new SnowTransfer("TOKEN")
|
|
352
|
+
* const time = Date.now()
|
|
353
|
+
* const message = await client.channel.createMessage("channel id", "pong")
|
|
354
|
+
* client.channel.editMessage("channel id", message.id, `pong ${Date.now() - time}ms`)
|
|
355
|
+
*/
|
|
356
|
+
editMessage(channelId: string, messageId: string, data: string | RESTPatchAPIChannelMessageJSONBody & {
|
|
357
|
+
files?: Array<{
|
|
358
|
+
name: string;
|
|
359
|
+
file: FileInput;
|
|
360
|
+
}>;
|
|
361
|
+
}): Promise<RESTPatchAPIChannelMessageResult>;
|
|
362
|
+
/**
|
|
363
|
+
* Delete a message
|
|
364
|
+
* @since 0.1.0
|
|
365
|
+
* @param channelId Id of the channel
|
|
366
|
+
* @param messageId Id of the message
|
|
367
|
+
* @param reason Reason for deleting the message
|
|
368
|
+
* @returns Resolves the Promise on successful execution
|
|
369
|
+
*
|
|
370
|
+
* | Permissions needed | Condition |
|
|
371
|
+
* |--------------------|----------------------------------------------|
|
|
372
|
+
* | VIEW_CHANNEL | if channel is not a DM channel |
|
|
373
|
+
* | MANAGE_MESSAGES | When the bot isn't the author of the message |
|
|
374
|
+
*
|
|
375
|
+
* @example
|
|
376
|
+
* // Delete a message
|
|
377
|
+
* const client = new SnowTransfer("TOKEN")
|
|
378
|
+
* client.channel.deleteMessage("channel id", "message id")
|
|
379
|
+
*/
|
|
380
|
+
deleteMessage(channelId: string, messageId: string, reason?: string): Promise<RESTDeleteAPIChannelMessageResult>;
|
|
381
|
+
/**
|
|
382
|
+
* Bulk delete messages from a guild channel, messages may not be older than 2 weeks
|
|
383
|
+
* @since 0.18.0
|
|
384
|
+
* @param channelId Id of the guild channel
|
|
385
|
+
* @param messages array of message ids to delete
|
|
386
|
+
* @param reason Reason for deleting the messages
|
|
387
|
+
* @returns Resolves the Promise on successful execution
|
|
388
|
+
*
|
|
389
|
+
* | Permissions needed | Condition |
|
|
390
|
+
* |--------------------|-----------|
|
|
391
|
+
* | VIEW_CHANNEL | always |
|
|
392
|
+
* | MANAGE_MESSAGES | always |
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* // Bulk deletes 2 messages with a reason of "spam"
|
|
396
|
+
* const client = new SnowTransfer("TOKEN")
|
|
397
|
+
* client.channel.deleteMessages("channel id", ["message id 1", "message id 2"], "spam")
|
|
398
|
+
*/
|
|
399
|
+
deleteMessages(channelId: string, messages: Array<string>, reason?: string): Promise<RESTPostAPIChannelMessagesBulkDeleteResult>;
|
|
400
|
+
/**
|
|
401
|
+
* Modify the permission overwrites of a guild channel
|
|
402
|
+
* @since 0.1.0
|
|
403
|
+
* @param channelId Id of the guild channel
|
|
404
|
+
* @param permissionId Id of the permission overwrite
|
|
405
|
+
* @param data modified [permission overwrite](https://discord.com/developers/docs/resources/channel#edit-channel-permissions-json-params) object
|
|
406
|
+
* @param reason Reason for editing the channel permission
|
|
407
|
+
* @returns Resolves the Promise on successful execution
|
|
408
|
+
*
|
|
409
|
+
* | Permissions needed | Condition |
|
|
410
|
+
* |--------------------|----------------------------|
|
|
411
|
+
* | MANAGE_CHANNELS | if channel is not a thread |
|
|
412
|
+
* | MANAGE_THREADS | if channel is a thread |
|
|
413
|
+
* | MANAGE_ROLES | always |
|
|
414
|
+
* | VIEW_CHANNEL | always |
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* // Edits the permissions of a user to allow viewing the channel only
|
|
418
|
+
* const client = new SnowTransfer("TOKEN")
|
|
419
|
+
* client.channel.editChannelPermission("channel id", "user id", { allow: String(1 << 10), type: 1 })
|
|
420
|
+
*/
|
|
421
|
+
editChannelPermission(channelId: string, permissionId: string, data: RESTPutAPIChannelPermissionJSONBody, reason?: string): Promise<RESTPutAPIChannelPermissionResult>;
|
|
422
|
+
/**
|
|
423
|
+
* Get a list of invites for a guild channel
|
|
424
|
+
* @since 0.1.0
|
|
425
|
+
* @param channelId Id of the guild channel
|
|
426
|
+
* @returns Array of [invite objects](https://discord.com/developers/docs/resources/invite#invite-object) (with metadata)
|
|
427
|
+
*
|
|
428
|
+
* | Permissions needed | Condition |
|
|
429
|
+
* |--------------------|-----------|
|
|
430
|
+
* | VIEW_CHANNEL | always |
|
|
431
|
+
* | MANAGE_CHANNELS | always |
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* const client = new SnowTransfer("TOKEN")
|
|
435
|
+
* const invites = await client.channel.getChannelInvites("channel id")
|
|
436
|
+
*/
|
|
437
|
+
getChannelInvites(channelId: string): Promise<RESTGetAPIChannelInvitesResult>;
|
|
438
|
+
/**
|
|
439
|
+
* Create an invite for a guild channel
|
|
440
|
+
*
|
|
441
|
+
* If no data argument is passed, the invite will be created with the defaults
|
|
442
|
+
* @since 0.1.0
|
|
443
|
+
* @param channelId Id of the channel
|
|
444
|
+
* @param data invite data (optional)
|
|
445
|
+
* @param reason Reason for creating the invite
|
|
446
|
+
* @returns [Invite object](https://discord.com/developers/docs/resources/invite#invite-object) (with metadata)
|
|
447
|
+
*
|
|
448
|
+
* | Permissions needed | Condition |
|
|
449
|
+
* |-----------------------|--------------------------------------------------------------------------|
|
|
450
|
+
* | VIEW_CHANNEL | always |
|
|
451
|
+
* | CREATE_INSTANT_INVITE | always |
|
|
452
|
+
* | MANAGE_ROLES | If specifying role_ids. You cannot specify a role higher than the sender |
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* // Creates a unique permanent invite with infinite uses
|
|
456
|
+
* const client = new SnowTransfer("TOKEN")
|
|
457
|
+
* const invite = await client.channel.createChannelInvite("channel id", { max_age: 0, max_uses: 0, unique: true })
|
|
458
|
+
*/
|
|
459
|
+
createChannelInvite(channelId: string, data?: RESTPostAPIChannelInviteJSONBody & {
|
|
460
|
+
target_users?: Array<string>;
|
|
461
|
+
role_ids?: Array<string>;
|
|
462
|
+
}, reason?: string): Promise<RESTPostAPIChannelInviteResult>;
|
|
463
|
+
/**
|
|
464
|
+
* Delete a permission overwrite from a guild channel
|
|
465
|
+
* @since 0.1.0
|
|
466
|
+
* @param channelId Id of the guild channel
|
|
467
|
+
* @param permissionId Id of the permission overwrite
|
|
468
|
+
* @param reason Reason for deleting the permission
|
|
469
|
+
* @returns Resolves the Promise on successful execution
|
|
470
|
+
*
|
|
471
|
+
* | Permissions needed | Condition |
|
|
472
|
+
* |--------------------|----------------------------|
|
|
473
|
+
* | MANAGE_CHANNELS | if channel is not a thread |
|
|
474
|
+
* | MANAGE_THREADS | if channel is a thread |
|
|
475
|
+
* | MANAGE_ROLES | always |
|
|
476
|
+
* | VIEW_CHANNEL | always |
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* // Deletes the permission overwrite of a user
|
|
480
|
+
* const client = new SnowTransfer("TOKEN")
|
|
481
|
+
* client.channel.deleteChannelPermission("channel id", "user id", "Abusing channel")
|
|
482
|
+
*/
|
|
483
|
+
deleteChannelPermission(channelId: string, permissionId: string, reason?: string): Promise<RESTDeleteAPIChannelPermissionResult>;
|
|
484
|
+
/**
|
|
485
|
+
* Follow an announcement channel to another channel
|
|
486
|
+
* @since 0.7.0
|
|
487
|
+
* @param channelId The Id of the announcement channel
|
|
488
|
+
* @param webhookChannelId The Id of the channel messages will be sent to
|
|
489
|
+
* @param reason Reason for following the annoucement channel
|
|
490
|
+
* @returns A [followed channel](https://discord.com/developers/docs/resources/channel#followed-channel-object) object
|
|
491
|
+
*
|
|
492
|
+
* | Permissions needed | Condition |
|
|
493
|
+
* |--------------------|-----------|
|
|
494
|
+
* | MANAGE_WEBHOOKS | always |
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* // Follows an announcement channel to a text channel
|
|
498
|
+
* const client = new SnowTransfer("TOKEN")
|
|
499
|
+
* client.channel.followAnnouncementChannel("news channel id", "text channel id")
|
|
500
|
+
*/
|
|
501
|
+
followAnnouncementChannel(channelId: string, webhookChannelId: string, reason?: string): Promise<RESTPostAPIChannelFollowersResult>;
|
|
502
|
+
/**
|
|
503
|
+
* Send an indicator that the current user is typing within a channel.
|
|
504
|
+
*
|
|
505
|
+
* **You should generally avoid this method unless used for longer computations (>1s)**
|
|
506
|
+
* @since 0.1.0
|
|
507
|
+
* @param channelId Id of the channel
|
|
508
|
+
* @returns Resolves the Promise on successful execution
|
|
509
|
+
*
|
|
510
|
+
* | Permissions needed | Condition |
|
|
511
|
+
* |--------------------------|--------------------------------|
|
|
512
|
+
* | VIEW_CHANNEL | if channel is not a DM channel |
|
|
513
|
+
* | SEND_MESSAGES | if channel is not a thread |
|
|
514
|
+
* | SEND_MESSAGES_IN_THREADS | if channel is a thread |
|
|
515
|
+
*
|
|
516
|
+
* @example
|
|
517
|
+
* const client = new SnowTransfer("TOKEN")
|
|
518
|
+
* client.channel.startChannelTyping("channel id")
|
|
519
|
+
*/
|
|
520
|
+
startChannelTyping(channelId: string): Promise<RESTPostAPIChannelTypingResult>;
|
|
521
|
+
/**
|
|
522
|
+
* Get a list of pinned messages for a channel
|
|
523
|
+
* @since 0.1.0
|
|
524
|
+
* @param channelId Id of the channel
|
|
525
|
+
* @returns Array of [message objects](https://discord.com/developers/docs/resources/channel#message-object)
|
|
526
|
+
*
|
|
527
|
+
* | Permissions needed | Condition |
|
|
528
|
+
* |----------------------|--------------------------------|
|
|
529
|
+
* | VIEW_CHANNEL | if channel is not a DM channel |
|
|
530
|
+
* | READ_MESSAGE_HISTORY | if channel is not a DM channel |
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* const client = new SnowTransfer("TOKEN")
|
|
534
|
+
* const messages = await client.channel.getChannelPinnedMessages("channel id")
|
|
535
|
+
*/
|
|
536
|
+
getChannelPinnedMessages(channelId: string, options?: RESTGetAPIChannelMessagesPinsQuery): Promise<RESTGetAPIChannelMessagesPinsResult>;
|
|
537
|
+
/**
|
|
538
|
+
* Pin a message within a channel
|
|
539
|
+
* @since 0.18.0
|
|
540
|
+
* @param channelId Id of the channel
|
|
541
|
+
* @param messageId Id of the message
|
|
542
|
+
* @param reason Reason for pinning the message
|
|
543
|
+
* @returns Resolves the Promise on successful execution
|
|
544
|
+
*
|
|
545
|
+
* | Permissions needed | Condition |
|
|
546
|
+
* |----------------------|--------------------------------|
|
|
547
|
+
* | VIEW_CHANNEL | if channel is not a DM channel |
|
|
548
|
+
* | READ_MESSAGE_HISTORY | if channel is not a DM channel |
|
|
549
|
+
* | PIN_MESSAGES | if channel is not a DM channel |
|
|
550
|
+
*
|
|
551
|
+
* @example
|
|
552
|
+
* // Pin a message because it was a good meme
|
|
553
|
+
* const client = new SnowTransfer("TOKEN")
|
|
554
|
+
* client.channel.createChannelPinnedMessage("channel id", "message id", "Good meme")
|
|
555
|
+
*/
|
|
556
|
+
createChannelPinnedMessage(channelId: string, messageId: string, reason?: string): Promise<RESTPutAPIChannelMessagesPinResult>;
|
|
557
|
+
/**
|
|
558
|
+
* Remove a pinned message from a channel
|
|
559
|
+
* @since 0.18.0
|
|
560
|
+
* @param channelId Id of the channel
|
|
561
|
+
* @param messageId Id of the message
|
|
562
|
+
* @param reason Reason for removing the pinned message
|
|
563
|
+
* @returns Resolves the Promise on successful execution
|
|
564
|
+
*
|
|
565
|
+
* | Permissions needed | Condition |
|
|
566
|
+
* |----------------------|--------------------------------|
|
|
567
|
+
* | VIEW_CHANNEL | if channel is not a DM channel |
|
|
568
|
+
* | READ_MESSAGE_HISTORY | if channel is not a DM channel |
|
|
569
|
+
* | PIN_MESSAGES | if channel is not a DM channel |
|
|
570
|
+
*
|
|
571
|
+
* @example
|
|
572
|
+
* // Remove a pinned message because mod abuse :(
|
|
573
|
+
* const client = new SnowTransfer("TOKEN")
|
|
574
|
+
* client.channel.deleteChannelPinnedMessage("channel id", "message id", "Mod abuse")
|
|
575
|
+
*/
|
|
576
|
+
deleteChannelPinnedMessage(channelId: string, messageId: string, reason?: string): Promise<RESTDeleteAPIChannelMessagesPinResult>;
|
|
577
|
+
/**
|
|
578
|
+
* Creates a public thread off a message in a guild channel
|
|
579
|
+
* @since 0.3.0
|
|
580
|
+
* @param channelId Id of the guild channel
|
|
581
|
+
* @param messageId Id of the message
|
|
582
|
+
* @param data Thread meta data
|
|
583
|
+
* @param reason Reason for creating the thread
|
|
584
|
+
* @returns [thread channel](https://discord.com/developers/docs/resources/channel#channel-object) object
|
|
585
|
+
*
|
|
586
|
+
* | Permissions needed | Condition |
|
|
587
|
+
* |-----------------------|-----------|
|
|
588
|
+
* | VIEW_CHANNEL | always |
|
|
589
|
+
* | CREATE_PUBLIC_THREADS | always |
|
|
590
|
+
*
|
|
591
|
+
* @example
|
|
592
|
+
* // Create a thread off a cool art piece to discuss
|
|
593
|
+
* const client = new SnowTransfer("TOKEN")
|
|
594
|
+
* const thread = await client.channel.createThreadWithMessage("channel id", "message id", { name: "cool-art", }, "I wanna talk about it!")
|
|
595
|
+
*/
|
|
596
|
+
createThreadWithMessage(channelId: string, messageId: string, data: RESTPostAPIChannelMessagesThreadsJSONBody, reason?: string): Promise<RESTPostAPIChannelMessagesThreadsResult>;
|
|
597
|
+
/**
|
|
598
|
+
* Creates a thread under a guild channel without a message
|
|
599
|
+
* @since 0.3.0
|
|
600
|
+
* @param channelId Id of the guild channel
|
|
601
|
+
* @param data Thread meta data
|
|
602
|
+
* @param reason Reason for creating the thread
|
|
603
|
+
* @returns [thread channel](https://discord.com/developers/docs/resources/channel#channel-object) object
|
|
604
|
+
*
|
|
605
|
+
* | Permissions needed | Condition |
|
|
606
|
+
* |------------------------|------------------------------|
|
|
607
|
+
* | VIEW_CHANNEL | always |
|
|
608
|
+
* | CREATE_PUBLIC_THREADS | if creating a public thread |
|
|
609
|
+
* | CREATE_PRIVATE_THREADS | if creating a private thread |
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* // Creates a private thread that's invitable to talk about someone's birthday
|
|
613
|
+
* const client = new SnowTransfer("TOKEN")
|
|
614
|
+
* const thread = await client.channel.createThreadWithoutMessage("channel id", { name: "persons-birthday", type: 12, invitable: true }, "Shh! It's a surprise")
|
|
615
|
+
*/
|
|
616
|
+
createThreadWithoutMessage(channelId: string, data: Omit<RESTPostAPIChannelThreadsJSONBody, "type"> & {
|
|
617
|
+
type: 10;
|
|
618
|
+
}, reason?: string): Promise<APITextBasedChannel<ChannelType.AnnouncementThread>>;
|
|
619
|
+
createThreadWithoutMessage(channelId: string, data: Omit<RESTPostAPIChannelThreadsJSONBody, "type"> & {
|
|
620
|
+
type: 11;
|
|
621
|
+
}, reason?: string): Promise<APITextBasedChannel<ChannelType.PublicThread>>;
|
|
622
|
+
createThreadWithoutMessage(channelId: string, data: Omit<RESTPostAPIChannelThreadsJSONBody, "type"> & {
|
|
623
|
+
type: 12;
|
|
624
|
+
}, reason?: string): Promise<APITextBasedChannel<ChannelType.PrivateThread>>;
|
|
625
|
+
/**
|
|
626
|
+
* Join a thread
|
|
627
|
+
* @since 0.3.0
|
|
628
|
+
* @param threadId Id of the thread
|
|
629
|
+
* @returns Resolves the Promise on successful execution
|
|
630
|
+
*
|
|
631
|
+
* | Permissions needed | Condition |
|
|
632
|
+
* |--------------------|-----------|
|
|
633
|
+
* | VIEW_CHANNEL | always |
|
|
634
|
+
*
|
|
635
|
+
* @example
|
|
636
|
+
* const client = new SnowTransfer("TOKEN")
|
|
637
|
+
* client.channel.joinThread("thread id")
|
|
638
|
+
*/
|
|
639
|
+
joinThread(threadId: string): Promise<RESTPutAPIChannelThreadMembersResult>;
|
|
640
|
+
/**
|
|
641
|
+
* Add a user to a thread
|
|
642
|
+
*
|
|
643
|
+
* CurrentUser must be a member of the thread
|
|
644
|
+
* @since 0.18.0
|
|
645
|
+
* @param threadId Id of the thread
|
|
646
|
+
* @param userId Id of the user to add
|
|
647
|
+
* @returns Resolves the Promise on successful execution
|
|
648
|
+
*
|
|
649
|
+
* | Permissions needed | Condition |
|
|
650
|
+
* |-----------------------------|-----------|
|
|
651
|
+
* | CurrentUser added to Thread | always |
|
|
652
|
+
* | SEND_MESSAGES_IN_THREADS | always |
|
|
653
|
+
*
|
|
654
|
+
* @example
|
|
655
|
+
* const client = new SnowTransfer("TOKEN")
|
|
656
|
+
* client.channel.joinThreadMember("thread id", "user id")
|
|
657
|
+
*/
|
|
658
|
+
joinThreadMember(threadId: string, userId: string): Promise<RESTPutAPIChannelThreadMembersResult>;
|
|
659
|
+
/**
|
|
660
|
+
* Leave a thread
|
|
661
|
+
* @since 0.3.0
|
|
662
|
+
* @param threadId Id of the thread
|
|
663
|
+
* @returns Resolves the Promise on successful execution
|
|
664
|
+
*
|
|
665
|
+
* @example
|
|
666
|
+
* const client = new SnowTransfer("TOKEN")
|
|
667
|
+
* client.channel.leaveThread("thread id")
|
|
668
|
+
*/
|
|
669
|
+
leaveThread(threadId: string): Promise<RESTDeleteAPIChannelThreadMembersResult>;
|
|
670
|
+
/**
|
|
671
|
+
* Remove a user from a thread
|
|
672
|
+
* @since 0.18.0
|
|
673
|
+
* @param threadId Id of the thread
|
|
674
|
+
* @param userId Id of the user to remove
|
|
675
|
+
* @returns Resolves the Promise on successful execution
|
|
676
|
+
*
|
|
677
|
+
* | Permissions needed | Condition |
|
|
678
|
+
* |--------------------|------------------------------------------------------|
|
|
679
|
+
* | MANAGE_THREADS | if the current user is not the creator of the thread |
|
|
680
|
+
*
|
|
681
|
+
* @example
|
|
682
|
+
* const client = new SnowTransfer("TOKEN")
|
|
683
|
+
* client.channel.deleteThreadMember("thread id", "user id")
|
|
684
|
+
*/
|
|
685
|
+
deleteThreadMember(threadId: string, userId: string): Promise<RESTDeleteAPIChannelThreadMembersResult>;
|
|
686
|
+
/**
|
|
687
|
+
* Gets a member of a thread
|
|
688
|
+
* @since 0.3.0
|
|
689
|
+
* @param threadId Id of the thread
|
|
690
|
+
* @param userId Id of the user
|
|
691
|
+
* @param withMember If a member object should be present
|
|
692
|
+
* @returns A [thread member](https://discord.com/developers/docs/resources/channel#thread-member-object)
|
|
693
|
+
*
|
|
694
|
+
* | Permissions needed | Condition |
|
|
695
|
+
* |--------------------|-----------|
|
|
696
|
+
* | VIEW_CHANNEL | always |
|
|
697
|
+
*
|
|
698
|
+
* @example
|
|
699
|
+
* const client = new SnowTransfer("TOKEN")
|
|
700
|
+
* const member = await client.channel.getThreadMember("thread id", "user id")
|
|
701
|
+
*/
|
|
702
|
+
getThreadMember(threadId: string, userId: string, withMember?: boolean): Promise<RESTGetAPIChannelThreadMemberResult>;
|
|
703
|
+
/**
|
|
704
|
+
* Gets all members within a thread
|
|
705
|
+
* @since 0.3.0
|
|
706
|
+
* @param channelId Id of the Thread
|
|
707
|
+
* @param options Options for getting members
|
|
708
|
+
* @returns Array of [thread members](https://discord.com/developers/docs/resources/channel#thread-member-object)
|
|
709
|
+
*
|
|
710
|
+
* | Permissions needed | Condition |
|
|
711
|
+
* |--------------------|-----------|
|
|
712
|
+
* | VIEW_CHANNEL | always |
|
|
713
|
+
*
|
|
714
|
+
* | Intents |
|
|
715
|
+
* |---------------|
|
|
716
|
+
* | GUILD_MEMBERS |
|
|
717
|
+
*
|
|
718
|
+
* @example
|
|
719
|
+
* const client = new SnowTransfer("TOKEN")
|
|
720
|
+
* const members = await client.channel.getThreadMembers("thread id")
|
|
721
|
+
*/
|
|
722
|
+
getThreadMembers(channelId: string, options?: RESTGetAPIChannelThreadMembersQuery): Promise<RESTGetAPIChannelThreadMembersResult>;
|
|
723
|
+
/**
|
|
724
|
+
* Gets all threads that are public and archived within a guild channel
|
|
725
|
+
* @since 0.3.0
|
|
726
|
+
* @param channelId Id of the guild channel
|
|
727
|
+
* @param options Options for getting threads
|
|
728
|
+
* @returns Object containing [public threads](https://discord.com/developers/docs/resources/channel#channel-object), [thread members](https://discord.com/developers/docs/resources/channel#thread-member-object) of the CurrentUser, and if there are more results in the pagination
|
|
729
|
+
*
|
|
730
|
+
* | Permissions needed | Condition |
|
|
731
|
+
* |----------------------|-----------|
|
|
732
|
+
* | VIEW_CHANNEL | always |
|
|
733
|
+
* | READ_MESSAGE_HISTORY | always |
|
|
734
|
+
*
|
|
735
|
+
* @example
|
|
736
|
+
* const client = new SnowTransfer("TOKEN")
|
|
737
|
+
* const result = await client.channel.getChannelArchivedPublicThreads("channel id")
|
|
738
|
+
*/
|
|
739
|
+
getChannelArchivedPublicThreads(channelId: string, options?: RESTGetAPIChannelThreadsArchivedQuery): Promise<RESTGetAPIChannelThreadsArchivedPublicResult>;
|
|
740
|
+
/**
|
|
741
|
+
* Gets all threads that are private and archived within a guild channel
|
|
742
|
+
*
|
|
743
|
+
* CurrentUser must be a member of the thread if they do not have MANAGE_THREADS permissions
|
|
744
|
+
* @since 0.3.0
|
|
745
|
+
* @param channelId Id of the Channel
|
|
746
|
+
* @param options Options for getting threads
|
|
747
|
+
* @returns Object containing [private threads](https://discord.com/developers/docs/resources/channel#channel-object), [thread members](https://discord.com/developers/docs/resources/channel#thread-member-object) of the CurrentUser, and if there are more results in the pagination
|
|
748
|
+
*
|
|
749
|
+
* | Permissions needed | Condition |
|
|
750
|
+
* |----------------------|--------------------------------------|
|
|
751
|
+
* | VIEW_CHANNEL | always |
|
|
752
|
+
* | READ_MESSAGE_HISTORY | always |
|
|
753
|
+
* | MANAGE_THREADS | if CurrentUser isn't added to Thread |
|
|
754
|
+
*
|
|
755
|
+
* @example
|
|
756
|
+
* const client = new SnowTransfer("TOKEN")
|
|
757
|
+
* const result = await client.channel.getChannelArchivedPrivateThreads("channel id")
|
|
758
|
+
*/
|
|
759
|
+
getChannelArchivedPrivateThreads(channelId: string, options?: RESTGetAPIChannelThreadsArchivedQuery): Promise<RESTGetAPIChannelThreadsArchivedPrivateResult>;
|
|
760
|
+
/**
|
|
761
|
+
* Gets all threads that are private and archived within a guild channel that the CurrentUser is apart of
|
|
762
|
+
*
|
|
763
|
+
* CurrentUser must be a member of the thread if they do not have MANAGE_THREADS permissions
|
|
764
|
+
* @since 0.3.0
|
|
765
|
+
* @param channelId Id of the Channel
|
|
766
|
+
* @param options Option for getting threads
|
|
767
|
+
* @returns Object containing [private threads](https://discord.com/developers/docs/resources/channel#channel-object), [thread members](https://discord.com/developers/docs/resources/channel#thread-member-object) of the CurrentUser, and if there are more results in the pagination
|
|
768
|
+
*
|
|
769
|
+
* | Permissions needed | Condition |
|
|
770
|
+
* |--------------------|-----------|
|
|
771
|
+
* | VIEW_CHANNEL | always |
|
|
772
|
+
*
|
|
773
|
+
* @example
|
|
774
|
+
* const client = new SnowTransfer("TOKEN")
|
|
775
|
+
* const result = await client.channel.getChannelArchivedPrivateThreadsUser("channel id")
|
|
776
|
+
*/
|
|
777
|
+
getChannelArchivedPrivateThreadsUser(channelId: string, options?: RESTGetAPIChannelThreadsArchivedQuery): Promise<RESTGetAPIChannelUsersThreadsArchivedResult>;
|
|
778
|
+
/**
|
|
779
|
+
* Refreshes Discord CDN attachments by URL to give you non-expired links. This also works on attachments the token may not have access to through means like guild bot presence
|
|
780
|
+
* @since 0.10.7
|
|
781
|
+
* @param attachments A list of Discord CDN attachment URLs. Does not require the URL(s) to have the expiration info parameters
|
|
782
|
+
* @returns Object containing a list of the original URLs inputted and refreshed URLs
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* const client = new SnowTransfer("TOKEN")
|
|
786
|
+
* const result = await client.channel.refreshAttachmentURLs("https://cdn.discordapp.com/attachments/1109362097952931840/1277799507911905280/traveler.gif")
|
|
787
|
+
*/
|
|
788
|
+
refreshAttachmentURLs(attachments: string | Array<string>): Promise<RESTPostAPIAttachmentsRefreshURLsResult>;
|
|
789
|
+
/**
|
|
790
|
+
* Get a list of users that voted for this specific answer
|
|
791
|
+
* @since 0.13.0
|
|
792
|
+
* @param channelId Id of the channel
|
|
793
|
+
* @param messageId Id of the message
|
|
794
|
+
* @param answerId Id of the answer
|
|
795
|
+
* @param options Options for getting the poll answers
|
|
796
|
+
* @returns An [answer object](https://discord.com/developers/docs/resources/poll#get-answer-voters-response-body)
|
|
797
|
+
*
|
|
798
|
+
* @example
|
|
799
|
+
* // Get whoever voted for an answer
|
|
800
|
+
* const client = new SnowTransfer("TOKEN")
|
|
801
|
+
* const data = await client.channel.getPollAnswerVoters("channel id", "message id", "answer id")
|
|
802
|
+
*/
|
|
803
|
+
getPollAnswerVoters(channelId: string, messageId: string, answerId: string, options?: RESTGetAPIPollAnswerVotersQuery): Promise<RESTGetAPIPollAnswerVotersResult>;
|
|
804
|
+
/**
|
|
805
|
+
* Immediately ends the poll. You cannot end polls from other users
|
|
806
|
+
* @since 0.13.0
|
|
807
|
+
* @param channelId Id of the channel
|
|
808
|
+
* @param messageId Id of the message
|
|
809
|
+
* @returns A [message object](https://discord.com/developers/docs/resources/message#message-object)
|
|
810
|
+
*
|
|
811
|
+
* @example
|
|
812
|
+
* // End a poll that the bot made
|
|
813
|
+
* const client = new SnowTransfer("TOKEN")
|
|
814
|
+
* client.channel.endPoll("channel id", "message id")
|
|
815
|
+
*/
|
|
816
|
+
endPoll(channelId: string, messageId: string): Promise<RESTPostAPIPollExpireResult>;
|
|
817
|
+
/**
|
|
818
|
+
* Sets a voice channel's status message
|
|
819
|
+
* @since 0.17.0
|
|
820
|
+
* @param channelId Id of the channel
|
|
821
|
+
* @param status The new status of the voice channel
|
|
822
|
+
* @param reason Reason for changing the status
|
|
823
|
+
* @returns Resolves the Promise on successful execution
|
|
824
|
+
*
|
|
825
|
+
* | Permissions needed | Condition |
|
|
826
|
+
* |--------------------------|---------------------------------------|
|
|
827
|
+
* | VIEW_CHANNEL | always |
|
|
828
|
+
* | SET_VOICE_CHANNEL_STATUS | always |
|
|
829
|
+
* | MANAGE_CHANNELS | if CurrentUser isn't in voice channel |
|
|
830
|
+
*
|
|
831
|
+
* @example
|
|
832
|
+
* // Sets the status to poggers
|
|
833
|
+
* const client = new SnowTransfer("TOKEN")
|
|
834
|
+
* client.channel.setVoiceChannelStatus("channel id", "poggers")
|
|
835
|
+
*
|
|
836
|
+
* @example
|
|
837
|
+
* // clears the status
|
|
838
|
+
* client.channel.setVoiceChannelStatus("channel id", "")
|
|
839
|
+
*/
|
|
840
|
+
setVoiceChannelStatus(channelId: string, status: string, reason?: string): Promise<RESTPutAPIChannelVoiceStatusResult>;
|
|
841
|
+
/**
|
|
842
|
+
* Sets a voice channel's "vibe" as Discord calls it, but it's actually just an image over all participants of a channel others in and not in the channel can see
|
|
843
|
+
* @since 0.17.6
|
|
844
|
+
* @param channelId Id of the channel
|
|
845
|
+
* @param imageUrl URL of an image to display
|
|
846
|
+
* @param reason Reason for changing the image
|
|
847
|
+
* @returns A [Guild Voice Channel](https://discord.com/developers/docs/resources/channel#channel-object)
|
|
848
|
+
*
|
|
849
|
+
* | Permissions needed | Condition |
|
|
850
|
+
* |--------------------------|---------------------------------------|
|
|
851
|
+
* | VIEW_CHANNEL | always |
|
|
852
|
+
* | SET_VOICE_CHANNEL_STATUS | always |
|
|
853
|
+
* | MANAGE_CHANNELS | if CurrentUser isn't in voice channel |
|
|
854
|
+
*
|
|
855
|
+
* @example
|
|
856
|
+
* // Sets the "vibe" image of the voice channel to Rick
|
|
857
|
+
* const client = new SnowTransfer("TOKEN")
|
|
858
|
+
* client.channel.setVoiceChannelHangout("channel id", "https://i3.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg")
|
|
859
|
+
*
|
|
860
|
+
* @example
|
|
861
|
+
* // clears the image
|
|
862
|
+
* client.channel.setVoiceChannelHangout("channel id", "")
|
|
863
|
+
*/
|
|
864
|
+
setVoiceChannelHangout(channelId: string, imageUrl: string, reason?: string): Promise<APIGuildVoiceChannel>;
|
|
865
|
+
}
|
|
866
|
+
export = ChannelMethods;
|