snowtransfer 0.9.0 → 0.10.0
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/README.md +1 -1
- package/dist/index.d.ts +108 -58
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# A minimalistic rest client for the discord api
|
|
2
2
|
|
|
3
3
|
---
|
|
4
|
-
[](https://github.com/DasWolke/SnowTransfer/stargazers) [](https://github.com/DasWolke/SnowTransfer/stargazers) [](https://www.npmjs.com/package/snowtransfer) [](https://www.npmjs.com/package/snowtransfer)
|
|
5
5
|
|
|
6
6
|
Part of the WeatherStack
|
|
7
7
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import {
|
|
2
|
+
import { Response, FormData, File } from 'undici';
|
|
3
3
|
import { RESTGetAPIAuditLogQuery, RESTGetAPIAuditLogResult, RESTGetAPIAutoModerationRulesResult, RESTGetAPIAutoModerationRuleResult, RESTPostAPIAutoModerationRuleJSONBody, RESTPostAPIAutoModerationRuleResult, RESTPatchAPIAutoModerationRuleJSONBody, RESTPatchAPIAutoModerationRuleResult, RESTDeleteAPIAutoModerationRuleResult, RESTGetAPIGatewayResult, RESTGetAPIGatewayBotResult, RESTGetAPIChannelResult, RESTPatchAPIChannelJSONBody, RESTPatchAPIChannelResult, APIThreadChannel, RESTDeleteAPIChannelResult, RESTGetAPIChannelMessagesQuery, RESTGetAPIChannelMessagesResult, RESTGetAPIChannelMessageResult, RESTPostAPIChannelMessageJSONBody, RESTPostAPIChannelMessageResult, RESTPostAPIChannelMessageCrosspostResult, RESTPutAPIChannelMessageReactionResult, RESTDeleteAPIChannelMessageUserReactionResult, RESTDeleteAPIChannelMessageReactionResult, RESTGetAPIChannelMessageReactionUsersQuery, RESTGetAPIChannelMessageReactionUsersResult, RESTDeleteAPIChannelAllMessageReactionsResult, RESTPatchAPIChannelMessageJSONBody, RESTPatchAPIChannelMessageResult, RESTDeleteAPIChannelMessageResult, RESTPostAPIChannelMessagesBulkDeleteResult, RESTPutAPIChannelPermissionJSONBody, RESTPutAPIChannelPermissionResult, RESTGetAPIChannelInvitesResult, RESTPostAPIChannelInviteJSONBody, RESTPostAPIChannelInviteResult, RESTDeleteAPIChannelPermissionResult, RESTPostAPIChannelFollowersResult, RESTPostAPIChannelTypingResult, RESTGetAPIChannelPinsResult, RESTPutAPIChannelPinResult, RESTDeleteAPIChannelPinResult, RESTPostAPIChannelMessagesThreadsJSONBody, RESTPostAPIChannelMessagesThreadsResult, RESTPostAPIChannelThreadsJSONBody, APITextBasedChannel, ChannelType, RESTPutAPIChannelThreadMembersResult, RESTDeleteAPIChannelThreadMembersResult, RESTGetAPIChannelThreadMemberResult, RESTGetAPIChannelThreadMembersQuery, RESTGetAPIChannelThreadMembersResult, RESTGetAPIChannelThreadsArchivedQuery, RESTGetAPIChannelThreadsArchivedPublicResult, RESTGetAPIChannelThreadsArchivedPrivateResult, RESTGetAPIChannelUsersThreadsArchivedResult, RESTGetAPIGuildEmojisResult, RESTGetAPIGuildEmojiResult, RESTPostAPIGuildEmojiJSONBody, RESTPostAPIGuildEmojiResult, RESTPatchAPIGuildEmojiJSONBody, RESTPatchAPIGuildEmojiResult, RESTDeleteAPIGuildEmojiResult, RESTGetAPIStickerResult, RESTGetAPIGuildStickersResult, RESTGetAPIGuildStickerResult, RESTPostAPIGuildStickerFormDataBody, RESTPostAPIGuildStickerResult, RESTPatchAPIGuildStickerJSONBody, RESTPatchAPIGuildStickerResult, RESTDeleteAPIGuildStickerResult, RESTPostAPIGuildsJSONBody, RESTPostAPIGuildsResult, RESTGetAPIGuildResult, RESTGetAPIGuildPreviewResult, RESTPatchAPIGuildJSONBody, RESTPatchAPIGuildResult, RESTDeleteAPIGuildResult, RESTGetAPIGuildChannelsResult, RESTPostAPIGuildChannelJSONBody, RESTPostAPIGuildChannelResult, RESTPatchAPIGuildChannelPositionsJSONBody, RESTPatchAPIGuildChannelPositionsResult, RESTGetAPIGuildThreadsResult, RESTGetAPIGuildMemberResult, RESTGetAPIGuildMembersQuery, RESTGetAPIGuildMembersResult, RESTGetAPIGuildMembersSearchQuery, RESTGetAPIGuildMembersSearchResult, RESTPutAPIGuildMemberJSONBody, RESTPutAPIGuildMemberResult, RESTPatchAPIGuildMemberJSONBody, RESTPatchAPIGuildMemberResult, RESTPatchAPICurrentGuildMemberJSONBody, APIGuildMember, RESTPutAPIGuildMemberRoleResult, RESTDeleteAPIGuildMemberRoleResult, RESTDeleteAPIGuildMemberResult, RESTGetAPIGuildBansQuery, RESTGetAPIGuildBansResult, RESTGetAPIGuildBanResult, RESTPutAPIGuildBanJSONBody, RESTPutAPIGuildBanResult, RESTDeleteAPIGuildBanResult, RESTGetAPIGuildRolesResult, RESTPostAPIGuildRoleJSONBody, RESTPostAPIGuildRoleResult, RESTPatchAPIGuildRolePositionsJSONBody, RESTPatchAPIGuildRolePositionsResult, RESTPatchAPIGuildRoleJSONBody, RESTPatchAPIGuildRoleResult, RESTDeleteAPIGuildRoleResult, RESTGetAPIGuildPruneCountQuery, RESTGetAPIGuildPruneCountResult, RESTPostAPIGuildPruneJSONBody, RESTPostAPIGuildPruneResult, RESTGetAPIGuildVoiceRegionsResult, RESTGetAPIGuildInvitesResult, RESTGetAPIGuildIntegrationsResult, RESTDeleteAPIGuildIntegrationResult, RESTGetAPIGuildWidgetSettingsResult, RESTPatchAPIGuildWidgetSettingsJSONBody, RESTPatchAPIGuildWidgetSettingsResult, APIGuildWidget, RESTGetAPIGuildVanityUrlResult, RESTGetAPIGuildWelcomeScreenResult, RESTPatchAPIGuildWelcomeScreenJSONBody, RESTPatchAPIGuildWelcomeScreenResult, RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody, RESTPatchAPIGuildVoiceStateCurrentMemberResult, RESTPatchAPIGuildVoiceStateUserJSONBody, RESTPatchAPIGuildVoiceStateUserResult, RESTGetAPIGuildScheduledEventsResult, RESTPostAPIGuildScheduledEventJSONBody, RESTPostAPIGuildScheduledEventResult, RESTGetAPIGuildScheduledEventResult, RESTPatchAPIGuildScheduledEventJSONBody, RESTPatchAPIGuildScheduledEventResult, RESTDeleteAPIGuildScheduledEventResult, RESTGetAPIGuildScheduledEventUsersQuery, RESTGetAPIGuildScheduledEventUsersResult, RESTGetAPITemplateResult, RESTPostAPITemplateCreateGuildJSONBody, RESTPostAPITemplateCreateGuildResult, RESTGetAPIGuildTemplatesResult, RESTPostAPIGuildTemplatesJSONBody, RESTPostAPIGuildTemplatesResult, RESTPutAPIGuildTemplateSyncResult, RESTPatchAPIGuildTemplateJSONBody, RESTPatchAPIGuildTemplateResult, RESTDeleteAPIGuildTemplateResult, RESTPostAPIChannelWebhookJSONBody, RESTPostAPIChannelWebhookResult, RESTGetAPIChannelWebhooksResult, RESTGetAPIGuildWebhooksResult, RESTGetAPIWebhookResult, RESTPatchAPIWebhookWithTokenJSONBody, RESTPatchAPIWebhookWithTokenResult, RESTPatchAPIWebhookJSONBody, RESTPatchAPIWebhookResult, RESTDeleteAPIWebhookResult, RESTPostAPIWebhookWithTokenJSONBody, RESTPostAPIWebhookWithTokenQuery, RESTPostAPIWebhookWithTokenResult, RESTPostAPIWebhookWithTokenWaitResult, RESTPostAPIWebhookWithTokenSlackQuery, RESTPostAPIWebhookWithTokenSlackResult, RESTPostAPIWebhookWithTokenSlackWaitResult, RESTPostAPIWebhookWithTokenGitHubQuery, RESTPostAPIWebhookWithTokenGitHubResult, RESTPostAPIWebhookWithTokenGitHubWaitResult, RESTGetAPIWebhookWithTokenMessageResult, RESTPatchAPIWebhookWithTokenMessageJSONBody, RESTPatchAPIWebhookWithTokenMessageResult, RESTDeleteAPIWebhookWithTokenMessageResult, RESTGetAPIApplicationCommandsResult, RESTPostAPIApplicationCommandsJSONBody, RESTPostAPIApplicationCommandsResult, RESTGetAPIApplicationCommandResult, RESTPatchAPIApplicationCommandJSONBody, RESTPatchAPIApplicationCommandResult, RESTPutAPIApplicationCommandsJSONBody, RESTPutAPIApplicationCommandsResult, RESTGetAPIApplicationGuildCommandsResult, RESTPostAPIApplicationGuildCommandsJSONBody, RESTPostAPIApplicationGuildCommandsResult, RESTGetAPIApplicationGuildCommandResult, RESTPatchAPIApplicationGuildCommandJSONBody, RESTPatchAPIApplicationGuildCommandResult, RESTPutAPIApplicationGuildCommandsJSONBody, RESTPutAPIApplicationGuildCommandsResult, RESTGetAPIApplicationCommandPermissionsResult, RESTPutAPIApplicationCommandPermissionsJSONBody, RESTPutAPIApplicationCommandPermissionsResult, RESTPostAPIInteractionCallbackJSONBody, RESTGetAPIInteractionOriginalResponseResult, RESTPatchAPIInteractionOriginalResponseJSONBody, RESTPatchAPIInteractionOriginalResponseResult, RESTDeleteAPIInteractionOriginalResponseResult, RESTPostAPIInteractionFollowupJSONBody, RESTPostAPIInteractionFollowupResult, RESTGetAPIInteractionFollowupResult, RESTPatchAPIInteractionFollowupJSONBody, RESTPatchAPIInteractionFollowupResult, RESTDeleteAPIInteractionFollowupResult, RESTGetAPIInviteQuery, RESTGetAPIInviteResult, RESTDeleteAPIInviteResult, RESTPostAPIStageInstanceJSONBody, RESTPostAPIStageInstanceResult, RESTGetAPIStageInstanceResult, RESTPatchAPIStageInstanceJSONBody, RESTPatchAPIStageInstanceResult, RESTDeleteAPIStageInstanceResult, RESTGetAPICurrentUserResult, RESTGetAPIUserResult, RESTPatchAPICurrentUserJSONBody, RESTPatchAPICurrentUserResult, RESTGetAPICurrentUserGuildsQuery, RESTGetAPICurrentUserGuildsResult, RESTDeleteAPICurrentUserGuildResult, RESTPostAPICurrentUserCreateDMChannelResult, RESTGetAPICurrentUserConnectionsResult, RESTGetAPICurrentUserApplicationRoleConnectionResult, RESTPutAPICurrentUserApplicationRoleConnectionJSONBody, RESTPutAPICurrentUserApplicationRoleConnectionResult, RESTGetAPIVoiceRegionsResult } from 'discord-api-types/v10';
|
|
4
4
|
import { Readable } from 'stream';
|
|
5
5
|
import { ReadableStream } from 'stream/web';
|
|
@@ -20,12 +20,12 @@ declare class DiscordAPIError extends Error {
|
|
|
20
20
|
* Ratelimiter used for handling the ratelimits imposed by the rest api
|
|
21
21
|
* @protected
|
|
22
22
|
*/
|
|
23
|
-
declare class Ratelimiter {
|
|
23
|
+
declare class Ratelimiter<B extends typeof GlobalBucket = typeof GlobalBucket> {
|
|
24
24
|
/**
|
|
25
25
|
* An object of Buckets that store rate limit info
|
|
26
26
|
*/
|
|
27
27
|
buckets: {
|
|
28
|
-
[routeKey: string]:
|
|
28
|
+
[routeKey: string]: InstanceType<B>;
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* If you're being globally rate limited
|
|
@@ -39,6 +39,10 @@ declare class Ratelimiter {
|
|
|
39
39
|
* Timeout that resets the global ratelimit once the timeframe has passed
|
|
40
40
|
*/
|
|
41
41
|
globalResetTimeout: NodeJS.Timeout | null;
|
|
42
|
+
/**
|
|
43
|
+
* The constructor function to call new on when creating buckets to cache and use
|
|
44
|
+
*/
|
|
45
|
+
BucketConstructor: B;
|
|
42
46
|
/**
|
|
43
47
|
* If you're being globally rate limited
|
|
44
48
|
*/
|
|
@@ -61,44 +65,34 @@ declare class Ratelimiter {
|
|
|
61
65
|
* @param url Endpoint of the request
|
|
62
66
|
* @param method Http method used by the request
|
|
63
67
|
*/
|
|
64
|
-
queue(fn: (bucket:
|
|
68
|
+
queue(fn: (bucket: InstanceType<B>) => any, url: string, method: string): void;
|
|
65
69
|
}
|
|
66
70
|
/**
|
|
67
71
|
* Bucket used for saving ratelimits
|
|
68
72
|
* @protected
|
|
69
73
|
*/
|
|
70
74
|
declare class LocalBucket {
|
|
71
|
-
ratelimiter: Ratelimiter;
|
|
72
|
-
routeKey: string;
|
|
73
|
-
/**
|
|
74
|
-
* array of functions waiting to be executed
|
|
75
|
-
*/
|
|
76
|
-
fnQueue: Array<{
|
|
77
|
-
fn: (...args: Array<any>) => any;
|
|
78
|
-
callback: () => any;
|
|
79
|
-
}>;
|
|
80
|
-
/**
|
|
81
|
-
* Number of functions that may be executed during the timeframe set in limitReset
|
|
82
|
-
*/
|
|
83
75
|
limit: number;
|
|
76
|
+
reset: number;
|
|
84
77
|
/**
|
|
85
78
|
* Remaining amount of executions during the current timeframe
|
|
86
79
|
*/
|
|
87
80
|
remaining: number;
|
|
88
81
|
/**
|
|
89
|
-
*
|
|
82
|
+
* array of functions waiting to be executed
|
|
90
83
|
*/
|
|
91
|
-
|
|
84
|
+
fnQueue: Array<() => any>;
|
|
92
85
|
/**
|
|
93
86
|
* Timeout that calls the reset function once the timeframe passed
|
|
94
87
|
*/
|
|
95
88
|
resetTimeout: NodeJS.Timeout | null;
|
|
96
89
|
/**
|
|
97
|
-
* Create a new bucket
|
|
98
|
-
* @param
|
|
99
|
-
* @param
|
|
90
|
+
* Create a new base bucket
|
|
91
|
+
* @param limit Number of functions that may be executed during the timeframe set in reset
|
|
92
|
+
* @param reset Timeframe in milliseconds until the ratelimit resets after first
|
|
93
|
+
* @param remaining Remaining amount of executions during the current timeframe
|
|
100
94
|
*/
|
|
101
|
-
constructor(
|
|
95
|
+
constructor(limit?: number, reset?: number, remaining?: number);
|
|
102
96
|
/**
|
|
103
97
|
* Queue a function to be executed
|
|
104
98
|
* @param fn function to be executed
|
|
@@ -113,12 +107,34 @@ declare class LocalBucket {
|
|
|
113
107
|
/**
|
|
114
108
|
* Reset the remaining tokens to the base limit
|
|
115
109
|
*/
|
|
116
|
-
|
|
110
|
+
resetRemaining(): void;
|
|
117
111
|
/**
|
|
118
112
|
* Clear the current queue of events to be sent
|
|
119
113
|
*/
|
|
120
114
|
dropQueue(): void;
|
|
121
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Extended bucket that respects global ratelimits
|
|
118
|
+
* @protected
|
|
119
|
+
*/
|
|
120
|
+
declare class GlobalBucket extends LocalBucket {
|
|
121
|
+
ratelimiter: Ratelimiter;
|
|
122
|
+
routeKey: string;
|
|
123
|
+
/**
|
|
124
|
+
* Create a new bucket that respects global rate limits
|
|
125
|
+
* @param ratelimiter ratelimiter used for ratelimiting requests. Assigned by ratelimiter
|
|
126
|
+
* @param routeKey Key used internally to routify requests. Assigned by ratelimiter
|
|
127
|
+
*/
|
|
128
|
+
constructor(ratelimiter: Ratelimiter, routeKey: string);
|
|
129
|
+
/**
|
|
130
|
+
* Check if there are any functions in the queue that haven't been executed yet
|
|
131
|
+
*/
|
|
132
|
+
checkQueue(): void;
|
|
133
|
+
/**
|
|
134
|
+
* Reset the remaining tokens to the base limit
|
|
135
|
+
*/
|
|
136
|
+
resetRemaining(): void;
|
|
137
|
+
}
|
|
122
138
|
type HandlerEvents = {
|
|
123
139
|
request: [string, {
|
|
124
140
|
endpoint: string;
|
|
@@ -213,21 +229,18 @@ declare class RequestHandler extends EventEmitter {
|
|
|
213
229
|
|
|
214
230
|
type ___RequestHandler_DiscordAPIError = DiscordAPIError;
|
|
215
231
|
declare const ___RequestHandler_DiscordAPIError: typeof DiscordAPIError;
|
|
232
|
+
type ___RequestHandler_GlobalBucket = GlobalBucket;
|
|
233
|
+
declare const ___RequestHandler_GlobalBucket: typeof GlobalBucket;
|
|
216
234
|
type ___RequestHandler_HTTPMethod = HTTPMethod;
|
|
235
|
+
type ___RequestHandler_HandlerEvents = HandlerEvents;
|
|
217
236
|
type ___RequestHandler_LocalBucket = LocalBucket;
|
|
218
237
|
declare const ___RequestHandler_LocalBucket: typeof LocalBucket;
|
|
219
|
-
type ___RequestHandler_Ratelimiter = Ratelimiter
|
|
238
|
+
type ___RequestHandler_Ratelimiter<B extends typeof GlobalBucket = typeof GlobalBucket> = Ratelimiter<B>;
|
|
220
239
|
declare const ___RequestHandler_Ratelimiter: typeof Ratelimiter;
|
|
221
240
|
type ___RequestHandler_RequestHandler = RequestHandler;
|
|
222
241
|
declare const ___RequestHandler_RequestHandler: typeof RequestHandler;
|
|
223
242
|
declare namespace ___RequestHandler {
|
|
224
|
-
export {
|
|
225
|
-
___RequestHandler_DiscordAPIError as DiscordAPIError,
|
|
226
|
-
___RequestHandler_HTTPMethod as HTTPMethod,
|
|
227
|
-
___RequestHandler_LocalBucket as LocalBucket,
|
|
228
|
-
___RequestHandler_Ratelimiter as Ratelimiter,
|
|
229
|
-
___RequestHandler_RequestHandler as RequestHandler,
|
|
230
|
-
};
|
|
243
|
+
export { ___RequestHandler_DiscordAPIError as DiscordAPIError, ___RequestHandler_GlobalBucket as GlobalBucket, type ___RequestHandler_HTTPMethod as HTTPMethod, type ___RequestHandler_HandlerEvents as HandlerEvents, ___RequestHandler_LocalBucket as LocalBucket, ___RequestHandler_Ratelimiter as Ratelimiter, ___RequestHandler_RequestHandler as RequestHandler };
|
|
231
244
|
}
|
|
232
245
|
|
|
233
246
|
/**
|
|
@@ -247,7 +260,7 @@ declare class AuditLogMethods {
|
|
|
247
260
|
/**
|
|
248
261
|
* Get the audit logs of the specified guild id
|
|
249
262
|
* @param guildId id of a guild
|
|
250
|
-
* @param
|
|
263
|
+
* @param options optional audit log filter values
|
|
251
264
|
* @returns An object with [audit log data](https://discord.com/developers/docs/resources/audit-log#audit-log-object)
|
|
252
265
|
*
|
|
253
266
|
* | Permissions needed | Condition |
|
|
@@ -263,7 +276,7 @@ declare class AuditLogMethods {
|
|
|
263
276
|
* }
|
|
264
277
|
* const channel = await client.auditLog.getAuditLog("guild id", data)
|
|
265
278
|
*/
|
|
266
|
-
getAuditLog(guildId: string,
|
|
279
|
+
getAuditLog(guildId: string, options?: RESTGetAPIAuditLogQuery): Promise<RESTGetAPIAuditLogResult>;
|
|
267
280
|
}
|
|
268
281
|
|
|
269
282
|
/**
|
|
@@ -501,6 +514,7 @@ declare class ChannelMethods {
|
|
|
501
514
|
/**
|
|
502
515
|
* Get a list of messages from a channel
|
|
503
516
|
* @param channelId Id of the channel
|
|
517
|
+
* @param options Options for getting channel messages
|
|
504
518
|
* @returns Array of [discord message](https://discord.com/developers/docs/resources/channel#message-object) objects
|
|
505
519
|
*
|
|
506
520
|
* | Permissions needed | Condition |
|
|
@@ -538,9 +552,10 @@ declare class ChannelMethods {
|
|
|
538
552
|
* Creates a new Message within a channel or thread
|
|
539
553
|
*
|
|
540
554
|
* **Make sure to use a filename with a proper extension (e.g. png, jpeg, etc.) when you want to upload files**
|
|
541
|
-
* @param channelId Id of the Channel or thread to
|
|
555
|
+
* @param channelId Id of the Channel or thread to send a message to
|
|
542
556
|
* @param data Data to send, if data is a string it will be used as the content of the message,
|
|
543
557
|
* if data is not a string you should take a look at the properties below to know what you may send
|
|
558
|
+
* @param options Options for sending this message
|
|
544
559
|
* @returns [discord message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
545
560
|
*
|
|
546
561
|
* | Permissions needed | Condition |
|
|
@@ -584,6 +599,29 @@ declare class ChannelMethods {
|
|
|
584
599
|
}, options?: {
|
|
585
600
|
disableEveryone?: boolean;
|
|
586
601
|
}): Promise<RESTPostAPIChannelMessageResult>;
|
|
602
|
+
/**
|
|
603
|
+
* Creates a new voice Message within a channel or thread
|
|
604
|
+
* @param channelId Id of the Channel or thread to send a message to
|
|
605
|
+
* @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:
|
|
606
|
+
* @param audioDurationSeconds The duration of the audio file in seconds
|
|
607
|
+
* @param waveform A preview of the entire voice message, with 1 byte per datapoint encoded in base64. Clients sample the recording at most once per 100 milliseconds, but will downsample so that no more than 256 datapoints are in the waveform. If you have no clue what you're doing, leave this as an empty string
|
|
608
|
+
* @returns non editable [discord message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
609
|
+
*
|
|
610
|
+
* | Permissions needed | Condition |
|
|
611
|
+
* |--------------------------|---------------------------------------------------------------|
|
|
612
|
+
* | VIEW_CHANNEL | if channel is not a DM channel |
|
|
613
|
+
* | READ_MESSAGE_HISTORY | if channel is not a DM channel and message is a reply |
|
|
614
|
+
* | SEND_MESSAGES | if channel is not a DM channel and if channel is not a thread |
|
|
615
|
+
* | SEND_MESSAGES_IN_THREADS | if channel is a thread |
|
|
616
|
+
*
|
|
617
|
+
* @example
|
|
618
|
+
* // Send a voice message that has a duration of 6 seconds
|
|
619
|
+
* const client = new SnowTransfer("TOKEN")
|
|
620
|
+
* // fileData will be a buffer with the data of the ogg audio
|
|
621
|
+
* 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.
|
|
622
|
+
* client.channel.createVoiceMessage("channel id", fileData, 6)
|
|
623
|
+
*/
|
|
624
|
+
createVoiceMessage(channelId: string, data: Buffer, audioDurationSeconds: number, waveform?: string): Promise<RESTPostAPIChannelMessageResult>;
|
|
587
625
|
/**
|
|
588
626
|
* Crosspost a message in a news channel to all following channels
|
|
589
627
|
* @param channelId Id of the news channel
|
|
@@ -683,7 +721,7 @@ declare class ChannelMethods {
|
|
|
683
721
|
* @param channelId Id of the channel
|
|
684
722
|
* @param messageId Id of the message
|
|
685
723
|
* @param emoji reaction emoji
|
|
686
|
-
* @param
|
|
724
|
+
* @param options Options for getting users
|
|
687
725
|
* @returns Array of [user objects](https://discord.com/developers/docs/resources/user#user-object)
|
|
688
726
|
*
|
|
689
727
|
* | Permissions needed | Condition |
|
|
@@ -696,7 +734,7 @@ declare class ChannelMethods {
|
|
|
696
734
|
* const client = new SnowTransfer("TOKEN")
|
|
697
735
|
* const reactions = await client.channel.getReactions("channel Id", "message Id", encodeURIComponent("awooo:322522663304036352"))
|
|
698
736
|
*/
|
|
699
|
-
getReactions(channelId: string, messageId: string, emoji: string,
|
|
737
|
+
getReactions(channelId: string, messageId: string, emoji: string, options?: RESTGetAPIChannelMessageReactionUsersQuery): Promise<RESTGetAPIChannelMessageReactionUsersResult>;
|
|
700
738
|
/**
|
|
701
739
|
* Delete all reactions from a message in a guild channel
|
|
702
740
|
* @param channelId Id of the guild channel
|
|
@@ -719,6 +757,7 @@ declare class ChannelMethods {
|
|
|
719
757
|
* @param channelId Id of the channel
|
|
720
758
|
* @param messageId Id of the message
|
|
721
759
|
* @param data Data to send
|
|
760
|
+
* @param options Options for editing this message
|
|
722
761
|
* @returns [discord message](https://discord.com/developers/docs/resources/channel#message-object) object
|
|
723
762
|
*
|
|
724
763
|
* | Permissions needed | Condition |
|
|
@@ -1067,6 +1106,7 @@ declare class ChannelMethods {
|
|
|
1067
1106
|
/**
|
|
1068
1107
|
* Gets all members within a thread
|
|
1069
1108
|
* @param channelId Id of the Thread
|
|
1109
|
+
* @param options Options for getting members
|
|
1070
1110
|
* @returns Array of [thread members](https://discord.com/developers/docs/resources/channel#thread-member-object)
|
|
1071
1111
|
*
|
|
1072
1112
|
* | Permissions needed | Condition |
|
|
@@ -1081,10 +1121,11 @@ declare class ChannelMethods {
|
|
|
1081
1121
|
* const client = new SnowTransfer("TOKEN")
|
|
1082
1122
|
* const members = await client.channel.getThreadMembers("thread id")
|
|
1083
1123
|
*/
|
|
1084
|
-
getThreadMembers(channelId: string,
|
|
1124
|
+
getThreadMembers(channelId: string, options?: RESTGetAPIChannelThreadMembersQuery): Promise<RESTGetAPIChannelThreadMembersResult>;
|
|
1085
1125
|
/**
|
|
1086
1126
|
* Gets all threads that are public and archived within a guild channel
|
|
1087
1127
|
* @param channelId Id of the guild channel
|
|
1128
|
+
* @param options Options for getting threads
|
|
1088
1129
|
* @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
|
|
1089
1130
|
*
|
|
1090
1131
|
* | Permissions needed | Condition |
|
|
@@ -1096,12 +1137,13 @@ declare class ChannelMethods {
|
|
|
1096
1137
|
* const client = new SnowTransfer("TOKEN")
|
|
1097
1138
|
* const result = await client.channel.getChannelArchivedPublicThreads("channel id")
|
|
1098
1139
|
*/
|
|
1099
|
-
getChannelArchivedPublicThreads(channelId: string,
|
|
1140
|
+
getChannelArchivedPublicThreads(channelId: string, options?: RESTGetAPIChannelThreadsArchivedQuery): Promise<RESTGetAPIChannelThreadsArchivedPublicResult>;
|
|
1100
1141
|
/**
|
|
1101
1142
|
* Gets all threads that are private and archived within a guild channel
|
|
1102
1143
|
*
|
|
1103
1144
|
* CurrentUser must be a member of the thread if they do not have MANAGE_THREADS permissions
|
|
1104
1145
|
* @param channelId Id of the Channel
|
|
1146
|
+
* @param options Options for getting threads
|
|
1105
1147
|
* @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
|
|
1106
1148
|
*
|
|
1107
1149
|
* | Permissions needed | Condition |
|
|
@@ -1114,12 +1156,13 @@ declare class ChannelMethods {
|
|
|
1114
1156
|
* const client = new SnowTransfer("TOKEN")
|
|
1115
1157
|
* const result = await client.channel.getChannelArchivedPrivateThreads("channel id")
|
|
1116
1158
|
*/
|
|
1117
|
-
getChannelArchivedPrivateThreads(channelId: string,
|
|
1159
|
+
getChannelArchivedPrivateThreads(channelId: string, options?: RESTGetAPIChannelThreadsArchivedQuery): Promise<RESTGetAPIChannelThreadsArchivedPrivateResult>;
|
|
1118
1160
|
/**
|
|
1119
1161
|
* Gets all threads that are private and archived within a guild channel that the CurrentUser is apart of
|
|
1120
1162
|
*
|
|
1121
1163
|
* CurrentUser must be a member of the thread if they do not have MANAGE_THREADS permissions
|
|
1122
1164
|
* @param channelId Id of the Channel
|
|
1165
|
+
* @param options Option for getting threads
|
|
1123
1166
|
* @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
|
|
1124
1167
|
*
|
|
1125
1168
|
* | Permissions needed | Condition |
|
|
@@ -1130,7 +1173,7 @@ declare class ChannelMethods {
|
|
|
1130
1173
|
* const client = new SnowTransfer("TOKEN")
|
|
1131
1174
|
* const result = await client.channel.getChannelArchivedPrivateThreadsUser("channel id")
|
|
1132
1175
|
*/
|
|
1133
|
-
getChannelArchivedPrivateThreadsUser(channelId: string,
|
|
1176
|
+
getChannelArchivedPrivateThreadsUser(channelId: string, options?: RESTGetAPIChannelThreadsArchivedQuery): Promise<RESTGetAPIChannelUsersThreadsArchivedResult>;
|
|
1134
1177
|
}
|
|
1135
1178
|
|
|
1136
1179
|
/**
|
|
@@ -1322,6 +1365,7 @@ declare class GuildAssetsMethods {
|
|
|
1322
1365
|
* Delete a guild sticker
|
|
1323
1366
|
* @param guildId Id of the guild
|
|
1324
1367
|
* @param stickerId Id of the sticker
|
|
1368
|
+
* @param reason Reason for deleting the sticker
|
|
1325
1369
|
* @returns Resolves the Promise on successful execution
|
|
1326
1370
|
*
|
|
1327
1371
|
* | Permissions needed | Condition |
|
|
@@ -1460,6 +1504,7 @@ declare class GuildMethods {
|
|
|
1460
1504
|
* Batch update the positions of channels. Only those being moved needs to be included here
|
|
1461
1505
|
* @param guildId Id of the guild
|
|
1462
1506
|
* @param data Positional data to send
|
|
1507
|
+
* @param reason Reason for updating the channels' positions
|
|
1463
1508
|
* @returns Resolves the Promise on successful execution
|
|
1464
1509
|
*
|
|
1465
1510
|
* | Permissions needed | Condition |
|
|
@@ -1469,7 +1514,7 @@ declare class GuildMethods {
|
|
|
1469
1514
|
* @example
|
|
1470
1515
|
* // Sets the position of a channel to 2 under a category channel
|
|
1471
1516
|
* const client = new SnowTransfer("TOKEN")
|
|
1472
|
-
* client.guild.updateChannelPositions("guild id", [{ id: "channel id", position: 2,
|
|
1517
|
+
* client.guild.updateChannelPositions("guild id", [{ id: "channel id", position: 2, parent_id: "category id" }], "they looked out of order")
|
|
1473
1518
|
*/
|
|
1474
1519
|
updateChannelPositions(guildId: string, data: RESTPatchAPIGuildChannelPositionsJSONBody, reason?: string): Promise<RESTPatchAPIGuildChannelPositionsResult>;
|
|
1475
1520
|
/**
|
|
@@ -1500,7 +1545,7 @@ declare class GuildMethods {
|
|
|
1500
1545
|
*
|
|
1501
1546
|
* CurrentUser must be a member of the guild
|
|
1502
1547
|
* @param guildId Id of the guild
|
|
1503
|
-
* @param
|
|
1548
|
+
* @param options query data
|
|
1504
1549
|
* @returns list of [guild members](https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure)
|
|
1505
1550
|
*
|
|
1506
1551
|
* | Intents |
|
|
@@ -1512,7 +1557,7 @@ declare class GuildMethods {
|
|
|
1512
1557
|
* const client = new SnowTransfer("TOKEN")
|
|
1513
1558
|
* const members = await client.guild.getGuildMembers("guild id", { limit: 10 })
|
|
1514
1559
|
*/
|
|
1515
|
-
getGuildMembers(guildId: string,
|
|
1560
|
+
getGuildMembers(guildId: string, options?: RESTGetAPIGuildMembersQuery): Promise<RESTGetAPIGuildMembersResult>;
|
|
1516
1561
|
/**
|
|
1517
1562
|
* Get a list of guild members that match a query
|
|
1518
1563
|
* @param guildId Id of the guild
|
|
@@ -1621,7 +1666,7 @@ declare class GuildMethods {
|
|
|
1621
1666
|
* @param guildId Id of the guild
|
|
1622
1667
|
* @param memberId Id of the guild member
|
|
1623
1668
|
* @param roleId Id of the role
|
|
1624
|
-
* @param
|
|
1669
|
+
* @param reason The reason for the role to be removed
|
|
1625
1670
|
* @returns Resolves the Promise on successful execution
|
|
1626
1671
|
*
|
|
1627
1672
|
* | Permissions needed | Condition |
|
|
@@ -1654,7 +1699,7 @@ declare class GuildMethods {
|
|
|
1654
1699
|
/**
|
|
1655
1700
|
* Get bans of a guild
|
|
1656
1701
|
* @param guildId Id of the guild
|
|
1657
|
-
* @param
|
|
1702
|
+
* @param options Query string options
|
|
1658
1703
|
* @returns List of [bans](https://discord.com/developers/docs/resources/guild#ban-object-ban-structure)
|
|
1659
1704
|
*
|
|
1660
1705
|
* | Permissions needed | Condition |
|
|
@@ -1763,6 +1808,7 @@ declare class GuildMethods {
|
|
|
1763
1808
|
* Modify the positions of roles
|
|
1764
1809
|
* @param guildId Id of the guild
|
|
1765
1810
|
* @param data Role data to update
|
|
1811
|
+
* @param reason Reason for moving the roles
|
|
1766
1812
|
* @returns array of [roles](https://discord.com/developers/docs/topics/permissions#role-object)
|
|
1767
1813
|
*
|
|
1768
1814
|
* | Permissions needed | Condition |
|
|
@@ -1813,7 +1859,7 @@ declare class GuildMethods {
|
|
|
1813
1859
|
/**
|
|
1814
1860
|
* Get the amount of members that would be pruned when a prune with the passed amount of days would be started
|
|
1815
1861
|
* @param guildId Id of the guild
|
|
1816
|
-
* @param
|
|
1862
|
+
* @param options Object with prune data
|
|
1817
1863
|
* @returns Object with a "pruned" key indicating the amount of members that would be pruned
|
|
1818
1864
|
*
|
|
1819
1865
|
* | Permissions needed | Condition |
|
|
@@ -1824,7 +1870,7 @@ declare class GuildMethods {
|
|
|
1824
1870
|
* const client = new SnowTransfer("TOKEN")
|
|
1825
1871
|
* const data = await client.guild.getGuildPruneCount("guildId", { days: 7 })
|
|
1826
1872
|
*/
|
|
1827
|
-
getGuildPruneCount(guildId: string,
|
|
1873
|
+
getGuildPruneCount(guildId: string, options?: RESTGetAPIGuildPruneCountQuery): Promise<RESTGetAPIGuildPruneCountResult>;
|
|
1828
1874
|
/**
|
|
1829
1875
|
* Start a prune
|
|
1830
1876
|
* @param guildId Id of the guild
|
|
@@ -1893,6 +1939,7 @@ declare class GuildMethods {
|
|
|
1893
1939
|
* Delete a guild integration
|
|
1894
1940
|
* @param guildId Id of the guild
|
|
1895
1941
|
* @param integrationId Id of the integration
|
|
1942
|
+
* @param reason Reason for removing the integration
|
|
1896
1943
|
* @returns Resolves the Promise on successful execution
|
|
1897
1944
|
*
|
|
1898
1945
|
* | Permissions needed | Condition |
|
|
@@ -2012,6 +2059,7 @@ declare class GuildMethods {
|
|
|
2012
2059
|
/**
|
|
2013
2060
|
* Updates a user's voice state in a stage channel
|
|
2014
2061
|
* @param guildId Id of the guild
|
|
2062
|
+
* @param userId Id of the user
|
|
2015
2063
|
* @param data Data of the voice state
|
|
2016
2064
|
* @returns Resolves the Promise on successful execution
|
|
2017
2065
|
*
|
|
@@ -2151,7 +2199,7 @@ declare class GuildScheduledEventMethods {
|
|
|
2151
2199
|
* const client = new SnowTransfer("TOKEN")
|
|
2152
2200
|
* const users = await client.guildScheduledEvent.getGuildScheduledEventUsers(guildId, eventId)
|
|
2153
2201
|
*/
|
|
2154
|
-
getGuildScheduledEventUsers(guildId: string, eventId: string,
|
|
2202
|
+
getGuildScheduledEventUsers(guildId: string, eventId: string, options?: RESTGetAPIGuildScheduledEventUsersQuery): Promise<RESTGetAPIGuildScheduledEventUsersResult>;
|
|
2155
2203
|
}
|
|
2156
2204
|
|
|
2157
2205
|
/**
|
|
@@ -2487,13 +2535,11 @@ declare class WebhookMethods {
|
|
|
2487
2535
|
* @param threadId Id of the thread the message was sent in
|
|
2488
2536
|
* @returns Resolves the Promise on successful execution
|
|
2489
2537
|
*/
|
|
2490
|
-
deleteWebhookMessage(webhookId: string, token: string, messageId: string,
|
|
2538
|
+
deleteWebhookMessage(webhookId: string, token: string, messageId: string, threadId?: string): Promise<RESTDeleteAPIWebhookWithTokenMessageResult>;
|
|
2491
2539
|
}
|
|
2492
2540
|
|
|
2493
2541
|
declare namespace __Webhooks {
|
|
2494
|
-
export {
|
|
2495
|
-
WebhookMethods as default,
|
|
2496
|
-
};
|
|
2542
|
+
export { WebhookMethods as default };
|
|
2497
2543
|
}
|
|
2498
2544
|
|
|
2499
2545
|
/**
|
|
@@ -2509,6 +2555,7 @@ declare class InteractionMethods {
|
|
|
2509
2555
|
*
|
|
2510
2556
|
* You can access the methods listed via `client.interaction.method`, where `client` is an initialized SnowTransfer instance
|
|
2511
2557
|
* @param requestHandler request handler that calls the rest api
|
|
2558
|
+
* @param webhooks WebhookMethods class that handles webhook related stuff
|
|
2512
2559
|
*/
|
|
2513
2560
|
constructor(requestHandler: InstanceType<(typeof ___RequestHandler)["RequestHandler"]>, webhooks: InstanceType<typeof __Webhooks>);
|
|
2514
2561
|
/**
|
|
@@ -2823,7 +2870,7 @@ declare class InviteMethods {
|
|
|
2823
2870
|
/**
|
|
2824
2871
|
* Get the invite data on an invite id
|
|
2825
2872
|
* @param inviteId Id of the invite
|
|
2826
|
-
* @param
|
|
2873
|
+
* @param options Query params for additional metadata fields
|
|
2827
2874
|
* @returns [Invite Object](https://discord.com/developers/docs/resources/invite#invite-object)
|
|
2828
2875
|
*
|
|
2829
2876
|
* @example
|
|
@@ -2831,7 +2878,7 @@ declare class InviteMethods {
|
|
|
2831
2878
|
* const client = new SnowTransfer("TOKEN")
|
|
2832
2879
|
* const invite = await client.invite.getInvite("inviteId", { with_counts: true })
|
|
2833
2880
|
*/
|
|
2834
|
-
getInvite(inviteId: string,
|
|
2881
|
+
getInvite(inviteId: string, options?: RESTGetAPIInviteQuery): Promise<RESTGetAPIInviteResult>;
|
|
2835
2882
|
/**
|
|
2836
2883
|
* Delete an invite
|
|
2837
2884
|
* @param inviteId
|
|
@@ -2883,7 +2930,7 @@ declare class StageInstanceMethods {
|
|
|
2883
2930
|
reason?: string;
|
|
2884
2931
|
}): Promise<RESTPostAPIStageInstanceResult>;
|
|
2885
2932
|
/**
|
|
2886
|
-
* Gets the stage instance
|
|
2933
|
+
* Gets the stage instance associated to a stage channel if it exists
|
|
2887
2934
|
* @param channelId Id of the stage channel
|
|
2888
2935
|
* @returns a [stage instance](https://discord.com/developers/docs/resources/stage-instance#auto-closing-stage-instance-structure) object
|
|
2889
2936
|
*
|
|
@@ -2914,6 +2961,7 @@ declare class StageInstanceMethods {
|
|
|
2914
2961
|
/**
|
|
2915
2962
|
* Delete an existing stage instance
|
|
2916
2963
|
* @param channelId Id of the stage channel
|
|
2964
|
+
* @param reason Reason for deleting the stage instance
|
|
2917
2965
|
* @returns a [stage instance](https://discord.com/developers/docs/resources/stage-instance#auto-closing-stage-instance-structure) object
|
|
2918
2966
|
*
|
|
2919
2967
|
* | Permissions needed | Condition |
|
|
@@ -2984,13 +3032,14 @@ declare class UserMethods {
|
|
|
2984
3032
|
updateSelf(data: RESTPatchAPICurrentUserJSONBody): Promise<RESTPatchAPICurrentUserResult>;
|
|
2985
3033
|
/**
|
|
2986
3034
|
* Get guilds of the current user
|
|
3035
|
+
* @param options Options for getting guilds
|
|
2987
3036
|
* @returns Array of [partial guild objects](https://discord.com/developers/docs/resources/guild#guild-object)
|
|
2988
3037
|
*
|
|
2989
3038
|
* @example
|
|
2990
3039
|
* const client = new SnowTransfer("TOKEN")
|
|
2991
3040
|
* const guilds = await client.user.getGuilds()
|
|
2992
3041
|
*/
|
|
2993
|
-
getGuilds(
|
|
3042
|
+
getGuilds(options?: RESTGetAPICurrentUserGuildsQuery): Promise<RESTGetAPICurrentUserGuildsResult>;
|
|
2994
3043
|
/**
|
|
2995
3044
|
* Leaves a guild
|
|
2996
3045
|
* @param guildId Id of the guild
|
|
@@ -3118,7 +3167,7 @@ declare const Constants: {
|
|
|
3118
3167
|
SEARCH_MEMBERS_MAX_RESULTS: 1000;
|
|
3119
3168
|
BULK_DELETE_MESSAGES_MIN: 2;
|
|
3120
3169
|
BULK_DELETE_MESSAGES_MAX: 100;
|
|
3121
|
-
OK_STATUS_CODES: number
|
|
3170
|
+
OK_STATUS_CODES: Set<number>;
|
|
3122
3171
|
standardMultipartHandler(data: {
|
|
3123
3172
|
files: Array<{
|
|
3124
3173
|
name: string;
|
|
@@ -3145,6 +3194,7 @@ declare const Endpoints: {
|
|
|
3145
3194
|
APPLICATION_GUILD_COMMAND: (appID: string, guildID: string, cmdID: string) => "/applications/{app_id}/guilds/{guild_id}/commands/{cmd_id}";
|
|
3146
3195
|
APPLICATION_GUILD_COMMANDS: (appID: string, guildID: string) => "/applications/{app_id}/guilds/{guild_id}/commands";
|
|
3147
3196
|
CHANNEL: (chanID: string) => "/channels/{channel_id}";
|
|
3197
|
+
CHANNEL_ATTACHMENTS: (chanID: string) => "/channels/{channel_id}/attachments";
|
|
3148
3198
|
CHANNEL_BULK_DELETE: (chanID: string) => "/channels/{channel_id}/messages/bulk-delete";
|
|
3149
3199
|
CHANNEL_FOLLOWERS: (chanID: string) => "/channels/{channel_id}/followers";
|
|
3150
3200
|
CHANNEL_INVITES: (chanID: string) => "/channels/{channel_id}/invites";
|
|
@@ -3262,4 +3312,4 @@ declare class SnowTransfer {
|
|
|
3262
3312
|
});
|
|
3263
3313
|
}
|
|
3264
3314
|
|
|
3265
|
-
export { AuditLogMethods, AutoModerationMethods, BotMethods, ChannelMethods, Constants, Endpoints, GuildAssetsMethods, GuildMethods, GuildScheduledEventMethods, GuildTemplateMethods, InteractionMethods, InviteMethods, SnowTransfer, StageInstanceMethods, UserMethods, VoiceMethods, WebhookMethods };
|
|
3315
|
+
export { AuditLogMethods, AutoModerationMethods, BotMethods, ChannelMethods, Constants, DiscordAPIError, Endpoints, GlobalBucket, GuildAssetsMethods, GuildMethods, GuildScheduledEventMethods, GuildTemplateMethods, type HTTPMethod, type HandlerEvents, InteractionMethods, InviteMethods, LocalBucket, Ratelimiter, RequestHandler, SnowTransfer, StageInstanceMethods, UserMethods, VoiceMethods, WebhookMethods };
|