dfx 0.20.5 → 0.21.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/Cache/driver.d.ts +16 -16
- package/Cache/driver.js.map +1 -1
- package/Cache/index.d.ts +21 -21
- package/Cache/index.js +12 -13
- package/Cache/index.js.map +1 -1
- package/Cache/memory.d.ts +3 -3
- package/Cache/memory.js +19 -20
- package/Cache/memory.js.map +1 -1
- package/Cache/memoryTTL.d.ts +5 -5
- package/Cache/memoryTTL.js +16 -16
- package/Cache/memoryTTL.js.map +1 -1
- package/Cache/prelude.d.ts +41 -41
- package/Cache/prelude.js +39 -41
- package/Cache/prelude.js.map +1 -1
- package/DiscordConfig/index.d.ts +4 -19
- package/DiscordConfig/index.js +5 -12
- package/DiscordConfig/index.js.map +1 -1
- package/DiscordGateway/DiscordWS/index.d.ts +9 -9
- package/DiscordGateway/DiscordWS/index.js +16 -20
- package/DiscordGateway/DiscordWS/index.js.map +1 -1
- package/DiscordGateway/Shard/heartbeats.d.ts +3 -4
- package/DiscordGateway/Shard/heartbeats.js +9 -16
- package/DiscordGateway/Shard/heartbeats.js.map +1 -1
- package/DiscordGateway/Shard/identify.d.ts +4 -4
- package/DiscordGateway/Shard/identify.js +5 -4
- package/DiscordGateway/Shard/identify.js.map +1 -1
- package/DiscordGateway/Shard/index.d.ts +8 -7
- package/DiscordGateway/Shard/index.js +17 -20
- package/DiscordGateway/Shard/index.js.map +1 -1
- package/DiscordGateway/Shard/invalidSession.d.ts +2 -3
- package/DiscordGateway/Shard/invalidSession.js +5 -8
- package/DiscordGateway/Shard/invalidSession.js.map +1 -1
- package/DiscordGateway/Shard/sendEvents.d.ts +1 -1
- package/DiscordGateway/Shard/sendEvents.js +7 -7
- package/DiscordGateway/Shard/sendEvents.js.map +1 -1
- package/DiscordGateway/Shard/utils.d.ts +3 -4
- package/DiscordGateway/Shard/utils.js +6 -6
- package/DiscordGateway/Shard/utils.js.map +1 -1
- package/DiscordGateway/ShardStore/index.d.ts +6 -6
- package/DiscordGateway/ShardStore/index.js +7 -10
- package/DiscordGateway/ShardStore/index.js.map +1 -1
- package/DiscordGateway/Sharder/index.d.ts +11 -11
- package/DiscordGateway/Sharder/index.js +21 -42
- package/DiscordGateway/Sharder/index.js.map +1 -1
- package/DiscordGateway/WS/index.d.ts +3 -2
- package/DiscordGateway/WS/index.js +30 -40
- package/DiscordGateway/WS/index.js.map +1 -1
- package/DiscordGateway/index.d.ts +8 -9
- package/DiscordGateway/index.js +10 -15
- package/DiscordGateway/index.js.map +1 -1
- package/DiscordREST/index.d.ts +132 -132
- package/DiscordREST/index.js +37 -40
- package/DiscordREST/index.js.map +1 -1
- package/DiscordREST/types.d.ts +6 -6
- package/DiscordREST/utils.d.ts +5 -4
- package/DiscordREST/utils.js +5 -5
- package/DiscordREST/utils.js.map +1 -1
- package/Helpers/intents.js +8 -8
- package/Helpers/intents.js.map +1 -1
- package/Helpers/interactions.d.ts +18 -19
- package/Helpers/interactions.js +22 -23
- package/Helpers/interactions.js.map +1 -1
- package/Helpers/members.d.ts +2 -2
- package/Helpers/members.js.map +1 -1
- package/Helpers/permissions.d.ts +4 -4
- package/Helpers/permissions.js +13 -13
- package/Helpers/permissions.js.map +1 -1
- package/Http/index.d.ts +10 -9
- package/Http/index.js +7 -8
- package/Http/index.js.map +1 -1
- package/Interactions/context.d.ts +22 -23
- package/Interactions/context.js +21 -21
- package/Interactions/context.js.map +1 -1
- package/Interactions/definitions.d.ts +31 -31
- package/Interactions/definitions.js +1 -2
- package/Interactions/definitions.js.map +1 -1
- package/Interactions/gateway.d.ts +4 -3
- package/Interactions/gateway.js +6 -6
- package/Interactions/gateway.js.map +1 -1
- package/Interactions/handlers.d.ts +3 -4
- package/Interactions/handlers.js +23 -23
- package/Interactions/handlers.js.map +1 -1
- package/Interactions/index.d.ts +11 -11
- package/Interactions/index.js +11 -10
- package/Interactions/index.js.map +1 -1
- package/Interactions/webhook.d.ts +7 -8
- package/Interactions/webhook.js +11 -12
- package/Interactions/webhook.js.map +1 -1
- package/Log/index.d.ts +8 -7
- package/Log/index.js +9 -11
- package/Log/index.js.map +1 -1
- package/RateLimit/index.d.ts +13 -12
- package/RateLimit/index.js +11 -12
- package/RateLimit/index.js.map +1 -1
- package/RateLimit/memory.d.ts +1 -1
- package/RateLimit/memory.js +7 -7
- package/RateLimit/memory.js.map +1 -1
- package/RateLimit/utils.d.ts +2 -2
- package/RateLimit/utils.js.map +1 -1
- package/_common.d.ts +19 -0
- package/_common.js +20 -0
- package/_common.js.map +1 -0
- package/gateway.d.ts +11 -10
- package/gateway.js +17 -14
- package/gateway.js.map +1 -1
- package/package.json +6 -16
- package/utils/effect.d.ts +8 -8
- package/utils/effect.js +4 -4
- package/utils/effect.js.map +1 -1
- package/webhooks.d.ts +6 -5
- package/webhooks.js +12 -8
- package/webhooks.js.map +1 -1
- package/global.d.ts +0 -21
- package/global.js +0 -2
- package/global.js.map +0 -1
- package/utils/common.d.ts +0 -18
- package/utils/common.js +0 -3
- package/utils/common.js.map +0 -1
package/DiscordREST/index.d.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Effect } from "dfx/utils/common";
|
|
1
|
+
import { Config, FetchError, Http, JsonParseError, Log, RateLimiter, RateLimitStore, StatusCodeError } from "dfx";
|
|
3
2
|
import { Success } from "dfx/utils/effect";
|
|
3
|
+
import { Context, Discord, Effect, Layer } from "dfx/_common";
|
|
4
4
|
import { ResponseWithData, RestResponse } from "./types.js";
|
|
5
|
-
declare const make:
|
|
6
|
-
addGuildMember: (guildId: string, userId: string, params?: Partial<
|
|
5
|
+
declare const make: Effect.Effect<Config.DiscordConfig | Http | Log.Log | RateLimitStore | RateLimiter, never, {
|
|
6
|
+
addGuildMember: (guildId: string, userId: string, params?: Partial<Discord.AddGuildMemberParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.GuildMember>;
|
|
7
7
|
addGuildMemberRole: (guildId: string, userId: string, roleId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
8
8
|
addThreadMember: (channelId: string, userId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
9
9
|
batchEditApplicationCommandPermissions: (applicationId: string, guildId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
10
|
-
beginGuildPrune: (guildId: string, params?: Partial<
|
|
11
|
-
bulkDeleteMessages: (channelId: string, params?: Partial<
|
|
12
|
-
bulkOverwriteGlobalApplicationCommands: (applicationId: string, options?: RequestInit | undefined) => RestResponse<
|
|
13
|
-
bulkOverwriteGuildApplicationCommands: (applicationId: string, guildId: string, params?: Partial<
|
|
14
|
-
createAutoModerationRule: (guildId: string, params?: Partial<
|
|
15
|
-
createChannelInvite: (channelId: string, params?: Partial<
|
|
16
|
-
createDm: (params?: Partial<
|
|
10
|
+
beginGuildPrune: (guildId: string, params?: Partial<Discord.BeginGuildPruneParams> | undefined, options?: RequestInit | undefined) => RestResponse<any>;
|
|
11
|
+
bulkDeleteMessages: (channelId: string, params?: Partial<Discord.BulkDeleteMessageParams> | undefined, options?: RequestInit | undefined) => RestResponse<any>;
|
|
12
|
+
bulkOverwriteGlobalApplicationCommands: (applicationId: string, options?: RequestInit | undefined) => RestResponse<Discord.ApplicationCommand[]>;
|
|
13
|
+
bulkOverwriteGuildApplicationCommands: (applicationId: string, guildId: string, params?: Partial<Discord.BulkOverwriteGuildApplicationCommandParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.ApplicationCommand[]>;
|
|
14
|
+
createAutoModerationRule: (guildId: string, params?: Partial<Discord.CreateAutoModerationRuleParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.AutoModerationRule>;
|
|
15
|
+
createChannelInvite: (channelId: string, params?: Partial<Discord.CreateChannelInviteParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Invite>;
|
|
16
|
+
createDm: (params?: Partial<Discord.CreateDmParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Channel>;
|
|
17
17
|
createFollowupMessage: (applicationId: string, interactionToken: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
18
|
-
createGlobalApplicationCommand: (applicationId: string, params?: Partial<
|
|
19
|
-
createGroupDm: (params?: Partial<
|
|
20
|
-
createGuild: (params?: Partial<
|
|
21
|
-
createGuildApplicationCommand: (applicationId: string, guildId: string, params?: Partial<
|
|
22
|
-
createGuildBan: (guildId: string, userId: string, params?: Partial<
|
|
23
|
-
createGuildChannel: (guildId: string, params?: Partial<
|
|
24
|
-
createGuildEmoji: (guildId: string, params?: Partial<
|
|
25
|
-
createGuildFromGuildTemplate: (templateCode: string, params?: Partial<
|
|
26
|
-
createGuildRole: (guildId: string, params?: Partial<
|
|
27
|
-
createGuildScheduledEvent: (guildId: string, params?: Partial<
|
|
28
|
-
createGuildSticker: (guildId: string, params?: Partial<
|
|
29
|
-
createGuildTemplate: (guildId: string, params?: Partial<
|
|
30
|
-
createInteractionResponse: (interactionId: string, interactionToken: string, params?: Partial<
|
|
31
|
-
createMessage: (channelId: string, params?: Partial<
|
|
18
|
+
createGlobalApplicationCommand: (applicationId: string, params?: Partial<Discord.CreateGlobalApplicationCommandParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.ApplicationCommand>;
|
|
19
|
+
createGroupDm: (params?: Partial<Discord.CreateGroupDmParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Channel>;
|
|
20
|
+
createGuild: (params?: Partial<Discord.CreateGuildParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Guild>;
|
|
21
|
+
createGuildApplicationCommand: (applicationId: string, guildId: string, params?: Partial<Discord.CreateGuildApplicationCommandParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.ApplicationCommand>;
|
|
22
|
+
createGuildBan: (guildId: string, userId: string, params?: Partial<Discord.CreateGuildBanParams> | undefined, options?: RequestInit | undefined) => RestResponse<any>;
|
|
23
|
+
createGuildChannel: (guildId: string, params?: Partial<Discord.CreateGuildChannelParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Channel>;
|
|
24
|
+
createGuildEmoji: (guildId: string, params?: Partial<Discord.CreateGuildEmojiParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Emoji>;
|
|
25
|
+
createGuildFromGuildTemplate: (templateCode: string, params?: Partial<Discord.CreateGuildFromGuildTemplateParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Guild>;
|
|
26
|
+
createGuildRole: (guildId: string, params?: Partial<Discord.CreateGuildRoleParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Role>;
|
|
27
|
+
createGuildScheduledEvent: (guildId: string, params?: Partial<Discord.CreateGuildScheduledEventParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.GuildScheduledEvent>;
|
|
28
|
+
createGuildSticker: (guildId: string, params?: Partial<Discord.CreateGuildStickerParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Sticker>;
|
|
29
|
+
createGuildTemplate: (guildId: string, params?: Partial<Discord.CreateGuildTemplateParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.GuildTemplate>;
|
|
30
|
+
createInteractionResponse: (interactionId: string, interactionToken: string, params?: Partial<Discord.InteractionResponse> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.InteractionResponse>;
|
|
31
|
+
createMessage: (channelId: string, params?: Partial<Discord.CreateMessageParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Message>;
|
|
32
32
|
createReaction: (channelId: string, messageId: string, emoji: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
33
|
-
createStageInstance: (params?: Partial<
|
|
34
|
-
createWebhook: (channelId: string, params?: Partial<
|
|
35
|
-
crosspostMessage: (channelId: string, messageId: string, options?: RequestInit | undefined) => RestResponse<
|
|
33
|
+
createStageInstance: (params?: Partial<Discord.CreateStageInstanceParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.StageInstance>;
|
|
34
|
+
createWebhook: (channelId: string, params?: Partial<Discord.CreateWebhookParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Webhook>;
|
|
35
|
+
crosspostMessage: (channelId: string, messageId: string, options?: RequestInit | undefined) => RestResponse<Discord.Message>;
|
|
36
36
|
deleteAllReactions: (channelId: string, messageId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
37
37
|
deleteAllReactionsForEmoji: (channelId: string, messageId: string, emoji: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
38
38
|
deleteAutoModerationRule: (guildId: string, autoModerationRuleId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
39
39
|
deleteChannelPermission: (channelId: string, overwriteId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
40
|
-
deletecloseChannel: (channelId: string, options?: RequestInit | undefined) => RestResponse<
|
|
40
|
+
deletecloseChannel: (channelId: string, options?: RequestInit | undefined) => RestResponse<Discord.Channel>;
|
|
41
41
|
deleteFollowupMessage: (applicationId: string, interactionToken: string, messageId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
42
42
|
deleteGlobalApplicationCommand: (applicationId: string, commandId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
43
43
|
deleteGuild: (guildId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
@@ -47,139 +47,139 @@ declare const make: import("../utils/common.js").Effect<import("../Log/index.js"
|
|
|
47
47
|
deleteGuildRole: (guildId: string, roleId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
48
48
|
deleteGuildScheduledEvent: (guildId: string, guildScheduledEventId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
49
49
|
deleteGuildSticker: (guildId: string, stickerId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
50
|
-
deleteGuildTemplate: (guildId: string, templateCode: string, options?: RequestInit | undefined) => RestResponse<
|
|
51
|
-
deleteInvite: (inviteCode: string, options?: RequestInit | undefined) => RestResponse<
|
|
50
|
+
deleteGuildTemplate: (guildId: string, templateCode: string, options?: RequestInit | undefined) => RestResponse<Discord.GuildTemplate>;
|
|
51
|
+
deleteInvite: (inviteCode: string, options?: RequestInit | undefined) => RestResponse<Discord.Invite>;
|
|
52
52
|
deleteMessage: (channelId: string, messageId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
53
53
|
deleteOriginalInteractionResponse: (applicationId: string, interactionToken: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
54
54
|
deleteOwnReaction: (channelId: string, messageId: string, emoji: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
55
55
|
deleteStageInstance: (channelId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
56
56
|
deleteUserReaction: (channelId: string, messageId: string, emoji: string, userId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
57
57
|
deleteWebhook: (webhookId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
58
|
-
deleteWebhookMessage: (webhookId: string, webhookToken: string, messageId: string, params?: Partial<
|
|
58
|
+
deleteWebhookMessage: (webhookId: string, webhookToken: string, messageId: string, params?: Partial<Discord.DeleteWebhookMessageParams> | undefined, options?: RequestInit | undefined) => RestResponse<any>;
|
|
59
59
|
deleteWebhookWithToken: (webhookId: string, webhookToken: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
60
|
-
editApplicationCommandPermissions: (applicationId: string, guildId: string, commandId: string, params?: Partial<
|
|
61
|
-
editChannelPermissions: (channelId: string, overwriteId: string, params?: Partial<
|
|
60
|
+
editApplicationCommandPermissions: (applicationId: string, guildId: string, commandId: string, params?: Partial<Discord.EditApplicationCommandPermissionParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.GuildApplicationCommandPermission>;
|
|
61
|
+
editChannelPermissions: (channelId: string, overwriteId: string, params?: Partial<Discord.EditChannelPermissionParams> | undefined, options?: RequestInit | undefined) => RestResponse<any>;
|
|
62
62
|
editFollowupMessage: (applicationId: string, interactionToken: string, messageId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
63
|
-
editGlobalApplicationCommand: (applicationId: string, commandId: string, params?: Partial<
|
|
64
|
-
editGuildApplicationCommand: (applicationId: string, guildId: string, commandId: string, params?: Partial<
|
|
65
|
-
editMessage: (channelId: string, messageId: string, params?: Partial<
|
|
63
|
+
editGlobalApplicationCommand: (applicationId: string, commandId: string, params?: Partial<Discord.EditGlobalApplicationCommandParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.ApplicationCommand>;
|
|
64
|
+
editGuildApplicationCommand: (applicationId: string, guildId: string, commandId: string, params?: Partial<Discord.EditGuildApplicationCommandParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.ApplicationCommand>;
|
|
65
|
+
editMessage: (channelId: string, messageId: string, params?: Partial<Discord.EditMessageParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Message>;
|
|
66
66
|
editOriginalInteractionResponse: (applicationId: string, interactionToken: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
67
|
-
editWebhookMessage: (webhookId: string, webhookToken: string, messageId: string, params?: Partial<
|
|
67
|
+
editWebhookMessage: (webhookId: string, webhookToken: string, messageId: string, params?: Partial<Discord.EditWebhookMessageParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Message>;
|
|
68
68
|
executeGitHubCompatibleWebhook: (webhookId: string, webhookToken: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
69
69
|
executeSlackCompatibleWebhook: (webhookId: string, webhookToken: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
70
|
-
executeWebhook: (webhookId: string, webhookToken: string, params?: Partial<
|
|
71
|
-
followAnnouncementChannel: (channelId: string, params?: Partial<
|
|
72
|
-
getApplicationCommandPermissions: (applicationId: string, guildId: string, commandId: string, options?: RequestInit | undefined) => RestResponse<
|
|
73
|
-
getAutoModerationRule: (guildId: string, autoModerationRuleId: string, options?: RequestInit | undefined) => RestResponse<
|
|
74
|
-
getChannel: (channelId: string, options?: RequestInit | undefined) => RestResponse<
|
|
75
|
-
getChannelInvites: (channelId: string, options?: RequestInit | undefined) => RestResponse<
|
|
76
|
-
getChannelMessage: (channelId: string, messageId: string, options?: RequestInit | undefined) => RestResponse<
|
|
77
|
-
getChannelMessages: (channelId: string, params?: Partial<
|
|
78
|
-
getChannelWebhooks: (channelId: string, options?: RequestInit | undefined) => RestResponse<
|
|
79
|
-
getCurrentAuthorizationInformation: (options?: RequestInit | undefined) => RestResponse<
|
|
80
|
-
getCurrentBotApplicationInformation: (options?: RequestInit | undefined) => RestResponse<
|
|
81
|
-
getCurrentUser: (options?: RequestInit | undefined) => RestResponse<
|
|
82
|
-
getCurrentUserGuildMember: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
83
|
-
getCurrentUserGuilds: (params?: Partial<
|
|
70
|
+
executeWebhook: (webhookId: string, webhookToken: string, params?: Partial<Discord.ExecuteWebhookParams> | undefined, options?: RequestInit | undefined) => RestResponse<any>;
|
|
71
|
+
followAnnouncementChannel: (channelId: string, params?: Partial<Discord.FollowAnnouncementChannelParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.FollowedChannel>;
|
|
72
|
+
getApplicationCommandPermissions: (applicationId: string, guildId: string, commandId: string, options?: RequestInit | undefined) => RestResponse<Discord.GuildApplicationCommandPermission>;
|
|
73
|
+
getAutoModerationRule: (guildId: string, autoModerationRuleId: string, options?: RequestInit | undefined) => RestResponse<Discord.AutoModerationRule>;
|
|
74
|
+
getChannel: (channelId: string, options?: RequestInit | undefined) => RestResponse<Discord.Channel>;
|
|
75
|
+
getChannelInvites: (channelId: string, options?: RequestInit | undefined) => RestResponse<Discord.Invite[]>;
|
|
76
|
+
getChannelMessage: (channelId: string, messageId: string, options?: RequestInit | undefined) => RestResponse<Discord.Message>;
|
|
77
|
+
getChannelMessages: (channelId: string, params?: Partial<Discord.GetChannelMessageParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Message[]>;
|
|
78
|
+
getChannelWebhooks: (channelId: string, options?: RequestInit | undefined) => RestResponse<Discord.Webhook[]>;
|
|
79
|
+
getCurrentAuthorizationInformation: (options?: RequestInit | undefined) => RestResponse<Discord.GetCurrentAuthorizationInformationResponse>;
|
|
80
|
+
getCurrentBotApplicationInformation: (options?: RequestInit | undefined) => RestResponse<Discord.Application>;
|
|
81
|
+
getCurrentUser: (options?: RequestInit | undefined) => RestResponse<Discord.User>;
|
|
82
|
+
getCurrentUserGuildMember: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.GuildMember>;
|
|
83
|
+
getCurrentUserGuilds: (params?: Partial<Discord.GetCurrentUserGuildParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Guild[]>;
|
|
84
84
|
getFollowupMessage: (applicationId: string, interactionToken: string, messageId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
85
85
|
getGateway: (options?: RequestInit | undefined) => RestResponse<any>;
|
|
86
|
-
getGatewayBot: (options?: RequestInit | undefined) => RestResponse<
|
|
87
|
-
getGlobalApplicationCommand: (applicationId: string, commandId: string, options?: RequestInit | undefined) => RestResponse<
|
|
88
|
-
getGlobalApplicationCommands: (applicationId: string, params?: Partial<
|
|
89
|
-
getGuild: (guildId: string, params?: Partial<
|
|
90
|
-
getGuildApplicationCommand: (applicationId: string, guildId: string, commandId: string, options?: RequestInit | undefined) => RestResponse<
|
|
91
|
-
getGuildApplicationCommandPermissions: (applicationId: string, guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
92
|
-
getGuildApplicationCommands: (applicationId: string, guildId: string, params?: Partial<
|
|
93
|
-
getGuildAuditLog: (guildId: string, params?: Partial<
|
|
94
|
-
getGuildBan: (guildId: string, userId: string, options?: RequestInit | undefined) => RestResponse<
|
|
95
|
-
getGuildBans: (guildId: string, params?: Partial<
|
|
96
|
-
getGuildChannels: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
97
|
-
getGuildEmoji: (guildId: string, emojiId: string, options?: RequestInit | undefined) => RestResponse<
|
|
98
|
-
getGuildIntegrations: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
99
|
-
getGuildInvites: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
100
|
-
getGuildMember: (guildId: string, userId: string, options?: RequestInit | undefined) => RestResponse<
|
|
101
|
-
getGuildPreview: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
102
|
-
getGuildPruneCount: (guildId: string, params?: Partial<
|
|
103
|
-
getGuildRoles: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
104
|
-
getGuildScheduledEvent: (guildId: string, guildScheduledEventId: string, params?: Partial<
|
|
105
|
-
getGuildScheduledEventUsers: (guildId: string, guildScheduledEventId: string, params?: Partial<
|
|
106
|
-
getGuildSticker: (guildId: string, stickerId: string, options?: RequestInit | undefined) => RestResponse<
|
|
107
|
-
getGuildTemplate: (templateCode: string, options?: RequestInit | undefined) => RestResponse<
|
|
108
|
-
getGuildTemplates: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
109
|
-
getGuildVanityUrl: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
110
|
-
getGuildVoiceRegions: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
111
|
-
getGuildWebhooks: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
112
|
-
getGuildWelcomeScreen: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
113
|
-
getGuildWidget: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
114
|
-
getGuildWidgetImage: (guildId: string, params?: Partial<
|
|
115
|
-
getGuildWidgetSettings: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
116
|
-
getInvite: (inviteCode: string, params?: Partial<
|
|
86
|
+
getGatewayBot: (options?: RequestInit | undefined) => RestResponse<Discord.GetGatewayBotResponse>;
|
|
87
|
+
getGlobalApplicationCommand: (applicationId: string, commandId: string, options?: RequestInit | undefined) => RestResponse<Discord.ApplicationCommand>;
|
|
88
|
+
getGlobalApplicationCommands: (applicationId: string, params?: Partial<Discord.GetGlobalApplicationCommandParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.ApplicationCommand[]>;
|
|
89
|
+
getGuild: (guildId: string, params?: Partial<Discord.GetGuildParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Guild>;
|
|
90
|
+
getGuildApplicationCommand: (applicationId: string, guildId: string, commandId: string, options?: RequestInit | undefined) => RestResponse<Discord.ApplicationCommand>;
|
|
91
|
+
getGuildApplicationCommandPermissions: (applicationId: string, guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.GuildApplicationCommandPermission[]>;
|
|
92
|
+
getGuildApplicationCommands: (applicationId: string, guildId: string, params?: Partial<Discord.GetGuildApplicationCommandParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.ApplicationCommand[]>;
|
|
93
|
+
getGuildAuditLog: (guildId: string, params?: Partial<Discord.GetGuildAuditLogParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.AuditLog>;
|
|
94
|
+
getGuildBan: (guildId: string, userId: string, options?: RequestInit | undefined) => RestResponse<Discord.Ban>;
|
|
95
|
+
getGuildBans: (guildId: string, params?: Partial<Discord.GetGuildBanParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Ban[]>;
|
|
96
|
+
getGuildChannels: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.Channel[]>;
|
|
97
|
+
getGuildEmoji: (guildId: string, emojiId: string, options?: RequestInit | undefined) => RestResponse<Discord.Emoji>;
|
|
98
|
+
getGuildIntegrations: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.Integration[]>;
|
|
99
|
+
getGuildInvites: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.Invite[]>;
|
|
100
|
+
getGuildMember: (guildId: string, userId: string, options?: RequestInit | undefined) => RestResponse<Discord.GuildMember>;
|
|
101
|
+
getGuildPreview: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.GuildPreview>;
|
|
102
|
+
getGuildPruneCount: (guildId: string, params?: Partial<Discord.GetGuildPruneCountParams> | undefined, options?: RequestInit | undefined) => RestResponse<any>;
|
|
103
|
+
getGuildRoles: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.Role[]>;
|
|
104
|
+
getGuildScheduledEvent: (guildId: string, guildScheduledEventId: string, params?: Partial<Discord.GetGuildScheduledEventParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.GuildScheduledEvent>;
|
|
105
|
+
getGuildScheduledEventUsers: (guildId: string, guildScheduledEventId: string, params?: Partial<Discord.GetGuildScheduledEventUserParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.GuildScheduledEventUser[]>;
|
|
106
|
+
getGuildSticker: (guildId: string, stickerId: string, options?: RequestInit | undefined) => RestResponse<Discord.Sticker>;
|
|
107
|
+
getGuildTemplate: (templateCode: string, options?: RequestInit | undefined) => RestResponse<Discord.GuildTemplate>;
|
|
108
|
+
getGuildTemplates: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.GuildTemplate[]>;
|
|
109
|
+
getGuildVanityUrl: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.Invite>;
|
|
110
|
+
getGuildVoiceRegions: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.VoiceRegion[]>;
|
|
111
|
+
getGuildWebhooks: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.Webhook[]>;
|
|
112
|
+
getGuildWelcomeScreen: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.WelcomeScreen>;
|
|
113
|
+
getGuildWidget: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.GuildWidget>;
|
|
114
|
+
getGuildWidgetImage: (guildId: string, params?: Partial<Discord.GetGuildWidgetImageParams> | undefined, options?: RequestInit | undefined) => RestResponse<any>;
|
|
115
|
+
getGuildWidgetSettings: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.GuildWidgetSetting>;
|
|
116
|
+
getInvite: (inviteCode: string, params?: Partial<Discord.GetInviteParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Invite>;
|
|
117
117
|
getOriginalInteractionResponse: (applicationId: string, interactionToken: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
118
|
-
getPinnedMessages: (channelId: string, options?: RequestInit | undefined) => RestResponse<
|
|
119
|
-
getReactions: (channelId: string, messageId: string, emoji: string, params?: Partial<
|
|
118
|
+
getPinnedMessages: (channelId: string, options?: RequestInit | undefined) => RestResponse<Discord.Message[]>;
|
|
119
|
+
getReactions: (channelId: string, messageId: string, emoji: string, params?: Partial<Discord.GetReactionParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.User[]>;
|
|
120
120
|
getStageInstance: (channelId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
121
|
-
getSticker: (stickerId: string, options?: RequestInit | undefined) => RestResponse<
|
|
122
|
-
getThreadMember: (channelId: string, userId: string, options?: RequestInit | undefined) => RestResponse<
|
|
123
|
-
getUser: (userId: string, options?: RequestInit | undefined) => RestResponse<
|
|
124
|
-
getUserConnections: (options?: RequestInit | undefined) => RestResponse<
|
|
125
|
-
getWebhook: (webhookId: string, options?: RequestInit | undefined) => RestResponse<
|
|
126
|
-
getWebhookMessage: (webhookId: string, webhookToken: string, messageId: string, params?: Partial<
|
|
121
|
+
getSticker: (stickerId: string, options?: RequestInit | undefined) => RestResponse<Discord.Sticker>;
|
|
122
|
+
getThreadMember: (channelId: string, userId: string, options?: RequestInit | undefined) => RestResponse<Discord.ThreadMember>;
|
|
123
|
+
getUser: (userId: string, options?: RequestInit | undefined) => RestResponse<Discord.User>;
|
|
124
|
+
getUserConnections: (options?: RequestInit | undefined) => RestResponse<Discord.Connection[]>;
|
|
125
|
+
getWebhook: (webhookId: string, options?: RequestInit | undefined) => RestResponse<Discord.Webhook>;
|
|
126
|
+
getWebhookMessage: (webhookId: string, webhookToken: string, messageId: string, params?: Partial<Discord.GetWebhookMessageParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Message>;
|
|
127
127
|
getWebhookWithToken: (webhookId: string, webhookToken: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
128
|
-
groupDmAddRecipient: (channelId: string, userId: string, params?: Partial<
|
|
128
|
+
groupDmAddRecipient: (channelId: string, userId: string, params?: Partial<Discord.GroupDmAddRecipientParams> | undefined, options?: RequestInit | undefined) => RestResponse<any>;
|
|
129
129
|
groupDmRemoveRecipient: (channelId: string, userId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
130
130
|
joinThread: (channelId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
131
131
|
leaveGuild: (guildId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
132
132
|
leaveThread: (channelId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
133
|
-
listActiveGuildThreads: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
134
|
-
listAutoModerationRulesForGuild: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
135
|
-
listGuildEmojis: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
136
|
-
listGuildMembers: (guildId: string, params?: Partial<
|
|
137
|
-
listGuildStickers: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
138
|
-
listJoinedPrivateArchivedThreads: (channelId: string, params?: Partial<
|
|
133
|
+
listActiveGuildThreads: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.ListActiveGuildThreadResponse>;
|
|
134
|
+
listAutoModerationRulesForGuild: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.AutoModerationRule[]>;
|
|
135
|
+
listGuildEmojis: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.Emoji[]>;
|
|
136
|
+
listGuildMembers: (guildId: string, params?: Partial<Discord.ListGuildMemberParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.GuildMember[]>;
|
|
137
|
+
listGuildStickers: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.Sticker[]>;
|
|
138
|
+
listJoinedPrivateArchivedThreads: (channelId: string, params?: Partial<Discord.ListJoinedPrivateArchivedThreadParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.ListJoinedPrivateArchivedThreadResponse>;
|
|
139
139
|
listNitroStickerPacks: (options?: RequestInit | undefined) => RestResponse<any>;
|
|
140
|
-
listPrivateArchivedThreads: (channelId: string, params?: Partial<
|
|
141
|
-
listPublicArchivedThreads: (channelId: string, params?: Partial<
|
|
142
|
-
listScheduledEventsForGuild: (guildId: string, params?: Partial<
|
|
143
|
-
listThreadMembers: (channelId: string, options?: RequestInit | undefined) => RestResponse<
|
|
144
|
-
listVoiceRegions: (options?: RequestInit | undefined) => RestResponse<
|
|
145
|
-
modifyAutoModerationRule: (guildId: string, autoModerationRuleId: string, params?: Partial<
|
|
146
|
-
modifyChannel: (channelId: string, params?: Partial<
|
|
147
|
-
modifyCurrentMember: (guildId: string, params?: Partial<
|
|
148
|
-
modifyCurrentUser: (params?: Partial<
|
|
149
|
-
modifyCurrentUserNick: (guildId: string, params?: Partial<
|
|
150
|
-
modifyCurrentUserVoiceState: (guildId: string, params?: Partial<
|
|
151
|
-
modifyGuild: (guildId: string, params?: Partial<
|
|
152
|
-
modifyGuildChannelPositions: (guildId: string, params?: Partial<
|
|
153
|
-
modifyGuildEmoji: (guildId: string, emojiId: string, params?: Partial<
|
|
154
|
-
modifyGuildMember: (guildId: string, userId: string, params?: Partial<
|
|
155
|
-
modifyGuildMfaLevel: (guildId: string, params?: Partial<
|
|
156
|
-
modifyGuildRole: (guildId: string, roleId: string, params?: Partial<
|
|
157
|
-
modifyGuildRolePositions: (guildId: string, params?: Partial<
|
|
158
|
-
modifyGuildScheduledEvent: (guildId: string, guildScheduledEventId: string, params?: Partial<
|
|
159
|
-
modifyGuildSticker: (guildId: string, stickerId: string, params?: Partial<
|
|
160
|
-
modifyGuildTemplate: (guildId: string, templateCode: string, params?: Partial<
|
|
161
|
-
modifyGuildWelcomeScreen: (guildId: string, params?: Partial<
|
|
162
|
-
modifyGuildWidget: (guildId: string, options?: RequestInit | undefined) => RestResponse<
|
|
163
|
-
modifyStageInstance: (channelId: string, params?: Partial<
|
|
164
|
-
modifyUserVoiceState: (guildId: string, userId: string, params?: Partial<
|
|
165
|
-
modifyWebhook: (webhookId: string, params?: Partial<
|
|
140
|
+
listPrivateArchivedThreads: (channelId: string, params?: Partial<Discord.ListPrivateArchivedThreadParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.ListPrivateArchivedThreadResponse>;
|
|
141
|
+
listPublicArchivedThreads: (channelId: string, params?: Partial<Discord.ListPublicArchivedThreadParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.ListPublicArchivedThreadResponse>;
|
|
142
|
+
listScheduledEventsForGuild: (guildId: string, params?: Partial<Discord.ListScheduledEventsForGuildParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.GuildScheduledEvent[]>;
|
|
143
|
+
listThreadMembers: (channelId: string, options?: RequestInit | undefined) => RestResponse<Discord.ThreadMember[]>;
|
|
144
|
+
listVoiceRegions: (options?: RequestInit | undefined) => RestResponse<Discord.VoiceRegion[]>;
|
|
145
|
+
modifyAutoModerationRule: (guildId: string, autoModerationRuleId: string, params?: Partial<Discord.ModifyAutoModerationRuleParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.AutoModerationRule>;
|
|
146
|
+
modifyChannel: (channelId: string, params?: Partial<Discord.ModifyChannelParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Channel>;
|
|
147
|
+
modifyCurrentMember: (guildId: string, params?: Partial<Discord.ModifyCurrentMemberParams> | undefined, options?: RequestInit | undefined) => RestResponse<any>;
|
|
148
|
+
modifyCurrentUser: (params?: Partial<Discord.ModifyCurrentUserParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.User>;
|
|
149
|
+
modifyCurrentUserNick: (guildId: string, params?: Partial<Discord.ModifyCurrentUserNickParams> | undefined, options?: RequestInit | undefined) => RestResponse<any>;
|
|
150
|
+
modifyCurrentUserVoiceState: (guildId: string, params?: Partial<Discord.ModifyCurrentUserVoiceStateParams> | undefined, options?: RequestInit | undefined) => RestResponse<any>;
|
|
151
|
+
modifyGuild: (guildId: string, params?: Partial<Discord.ModifyGuildParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Guild>;
|
|
152
|
+
modifyGuildChannelPositions: (guildId: string, params?: Partial<Discord.ModifyGuildChannelPositionParams> | undefined, options?: RequestInit | undefined) => RestResponse<any>;
|
|
153
|
+
modifyGuildEmoji: (guildId: string, emojiId: string, params?: Partial<Discord.ModifyGuildEmojiParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Emoji>;
|
|
154
|
+
modifyGuildMember: (guildId: string, userId: string, params?: Partial<Discord.ModifyGuildMemberParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.GuildMember>;
|
|
155
|
+
modifyGuildMfaLevel: (guildId: string, params?: Partial<Discord.ModifyGuildMfaLevelParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.MfaLevel>;
|
|
156
|
+
modifyGuildRole: (guildId: string, roleId: string, params?: Partial<Discord.ModifyGuildRoleParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Role>;
|
|
157
|
+
modifyGuildRolePositions: (guildId: string, params?: Partial<Discord.ModifyGuildRolePositionParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Role[]>;
|
|
158
|
+
modifyGuildScheduledEvent: (guildId: string, guildScheduledEventId: string, params?: Partial<Discord.ModifyGuildScheduledEventParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.GuildScheduledEvent>;
|
|
159
|
+
modifyGuildSticker: (guildId: string, stickerId: string, params?: Partial<Discord.ModifyGuildStickerParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Sticker>;
|
|
160
|
+
modifyGuildTemplate: (guildId: string, templateCode: string, params?: Partial<Discord.ModifyGuildTemplateParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.GuildTemplate>;
|
|
161
|
+
modifyGuildWelcomeScreen: (guildId: string, params?: Partial<Discord.ModifyGuildWelcomeScreenParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.WelcomeScreen>;
|
|
162
|
+
modifyGuildWidget: (guildId: string, options?: RequestInit | undefined) => RestResponse<Discord.GuildWidgetSetting>;
|
|
163
|
+
modifyStageInstance: (channelId: string, params?: Partial<Discord.ModifyStageInstanceParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.StageInstance>;
|
|
164
|
+
modifyUserVoiceState: (guildId: string, userId: string, params?: Partial<Discord.ModifyUserVoiceStateParams> | undefined, options?: RequestInit | undefined) => RestResponse<any>;
|
|
165
|
+
modifyWebhook: (webhookId: string, params?: Partial<Discord.ModifyWebhookParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Webhook>;
|
|
166
166
|
modifyWebhookWithToken: (webhookId: string, webhookToken: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
167
167
|
pinMessage: (channelId: string, messageId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
168
168
|
removeGuildBan: (guildId: string, userId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
169
169
|
removeGuildMember: (guildId: string, userId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
170
170
|
removeGuildMemberRole: (guildId: string, userId: string, roleId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
171
171
|
removeThreadMember: (channelId: string, userId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
172
|
-
searchGuildMembers: (guildId: string, params?: Partial<
|
|
173
|
-
startThreadFromMessage: (channelId: string, messageId: string, params?: Partial<
|
|
174
|
-
startThreadInForumChannel: (channelId: string, params?: Partial<
|
|
175
|
-
startThreadWithoutMessage: (channelId: string, params?: Partial<
|
|
176
|
-
syncGuildTemplate: (guildId: string, templateCode: string, options?: RequestInit | undefined) => RestResponse<
|
|
172
|
+
searchGuildMembers: (guildId: string, params?: Partial<Discord.SearchGuildMemberParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.GuildMember[]>;
|
|
173
|
+
startThreadFromMessage: (channelId: string, messageId: string, params?: Partial<Discord.StartThreadFromMessageParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Channel>;
|
|
174
|
+
startThreadInForumChannel: (channelId: string, params?: Partial<Discord.StartThreadInForumChannelParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Channel>;
|
|
175
|
+
startThreadWithoutMessage: (channelId: string, params?: Partial<Discord.StartThreadWithoutMessageParams> | undefined, options?: RequestInit | undefined) => RestResponse<Discord.Channel>;
|
|
176
|
+
syncGuildTemplate: (guildId: string, templateCode: string, options?: RequestInit | undefined) => RestResponse<Discord.GuildTemplate>;
|
|
177
177
|
triggerTypingIndicator: (channelId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
178
178
|
unpinMessage: (channelId: string, messageId: string, options?: RequestInit | undefined) => RestResponse<any>;
|
|
179
|
-
request: <A = unknown>(path: string, init?: RequestInit) =>
|
|
179
|
+
request: <A = unknown>(path: string, init?: RequestInit) => Effect.Effect<never, FetchError | StatusCodeError | JsonParseError, ResponseWithData<A>>;
|
|
180
180
|
}>;
|
|
181
181
|
export interface DiscordREST extends Success<typeof make> {
|
|
182
182
|
}
|
|
183
|
-
export declare const DiscordREST:
|
|
184
|
-
export declare const LiveDiscordREST:
|
|
183
|
+
export declare const DiscordREST: Context.Tag<DiscordREST>;
|
|
184
|
+
export declare const LiveDiscordREST: Layer.Layer<Config.DiscordConfig | Http | Log.Log | RateLimitStore | RateLimiter, never, DiscordREST>;
|
|
185
185
|
export {};
|
package/DiscordREST/index.js
CHANGED
|
@@ -1,49 +1,46 @@
|
|
|
1
|
-
import * as tsplus_module_1 from "
|
|
2
|
-
import * as tsplus_module_2 from "@
|
|
3
|
-
import * as tsplus_module_3 from "@fp-ts/data/
|
|
4
|
-
import * as tsplus_module_4 from "@
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import * as tsplus_module_7 from "dfx/utils/common";
|
|
8
|
-
import * as tsplus_module_8 from "@effect/io/Layer";
|
|
9
|
-
import { millis } from "@fp-ts/data/Duration";
|
|
10
|
-
import { rateLimitFromHeaders, routeFromConfig, retryAfter } from "./utils.js";
|
|
1
|
+
import * as tsplus_module_1 from "@effect/io/Effect";
|
|
2
|
+
import * as tsplus_module_2 from "@fp-ts/data/Option";
|
|
3
|
+
import * as tsplus_module_3 from "@fp-ts/data/HashSet";
|
|
4
|
+
import * as tsplus_module_4 from "@effect/io/Ref";
|
|
5
|
+
import { Config, Http, Log, RateLimiter, RateLimitStore, } from "dfx";
|
|
6
|
+
import { Context, Discord, Duration, Effect, HashSet, Layer, Ref, } from "dfx/_common";
|
|
11
7
|
import Pkg from "../package.json" assert { type: "json" };
|
|
12
|
-
|
|
8
|
+
import { rateLimitFromHeaders, retryAfter, routeFromConfig } from "./utils.js";
|
|
9
|
+
const make = tsplus_module_1.flatMap(http => tsplus_module_1.flatMap(({ token, rest }) => tsplus_module_1.flatMap(log => tsplus_module_1.flatMap(store => tsplus_module_1.flatMap(({ maybeWait }) => {
|
|
13
10
|
const globalRateLimit = maybeWait("dfx.rest.global", rest.globalRateLimit.window, rest.globalRateLimit.limit);
|
|
14
|
-
return
|
|
15
|
-
const addBadRoute = (route) =>
|
|
11
|
+
return tsplus_module_1.map(badRoutesRef => {
|
|
12
|
+
const addBadRoute = (route) => tsplus_module_1.collectAllParDiscard([
|
|
16
13
|
log.info("DiscordREST", "addBadRoute", route),
|
|
17
|
-
|
|
18
|
-
store.incrementCounter("dfx.rest.invalid",
|
|
14
|
+
tsplus_module_4.update((s) => tsplus_module_3.add(route)(s))(badRoutesRef),
|
|
15
|
+
store.incrementCounter("dfx.rest.invalid", Duration.minutes(10).millis, 10000),
|
|
19
16
|
]);
|
|
20
|
-
const isBadRoute = (route) =>
|
|
21
|
-
const removeBadRoute = (route) =>
|
|
22
|
-
const invalidRateLimit = (route) =>
|
|
23
|
-
? maybeWait("dfx.rest.invalid",
|
|
24
|
-
:
|
|
17
|
+
const isBadRoute = (route) => tsplus_module_1.map((s) => tsplus_module_3.has(route)(s))(tsplus_module_4.get(badRoutesRef));
|
|
18
|
+
const removeBadRoute = (route) => tsplus_module_4.update((s) => tsplus_module_3.remove(route)(s))(badRoutesRef);
|
|
19
|
+
const invalidRateLimit = (route) => tsplus_module_1.asUnit(tsplus_module_1.tap((invalid) => invalid
|
|
20
|
+
? maybeWait("dfx.rest.invalid", Duration.minutes(10), 10000)
|
|
21
|
+
: Effect.unit())(isBadRoute(route)));
|
|
25
22
|
// Request rate limiting
|
|
26
23
|
const requestRateLimit = (path, init) => (() => {
|
|
27
24
|
const route = routeFromConfig(path, init);
|
|
28
|
-
return
|
|
29
|
-
const bucket =
|
|
25
|
+
return tsplus_module_1.flatMap(maybeBucket => {
|
|
26
|
+
const bucket = tsplus_module_2.getOrElse(() => ({
|
|
30
27
|
key: `?.${route}`,
|
|
31
28
|
resetAfter: 5000,
|
|
32
29
|
limit: 1,
|
|
33
30
|
}))(maybeBucket);
|
|
34
|
-
const resetAfter = millis(bucket.resetAfter);
|
|
35
|
-
return
|
|
31
|
+
const resetAfter = Duration.millis(bucket.resetAfter);
|
|
32
|
+
return tsplus_module_1.flatMap(() => tsplus_module_1.map(() => void 0)(maybeWait(`dfx.rest.${bucket.key}`, resetAfter, bucket.limit)))(invalidRateLimit(route));
|
|
36
33
|
})(store.getBucketForRoute(route));
|
|
37
34
|
})();
|
|
38
35
|
// Update rate limit buckets
|
|
39
|
-
const updateBuckets = (path, init, response) =>
|
|
36
|
+
const updateBuckets = (path, init, response) => tsplus_module_1.ignore((() => {
|
|
40
37
|
const route = routeFromConfig(path, init);
|
|
41
|
-
return
|
|
38
|
+
return tsplus_module_1.flatMap(({ bucket, retryAfter, limit, remaining }) => {
|
|
42
39
|
const effectsToRun = [
|
|
43
40
|
removeBadRoute(route),
|
|
44
41
|
store.putBucketRoute(route, bucket),
|
|
45
42
|
];
|
|
46
|
-
return
|
|
43
|
+
return tsplus_module_1.flatMap(hasBucket => {
|
|
47
44
|
if (!hasBucket || limit - 1 === remaining) {
|
|
48
45
|
effectsToRun.push(store.putBucket({
|
|
49
46
|
key: bucket,
|
|
@@ -51,28 +48,28 @@ const make = tsplus_module_2.flatMap(http => tsplus_module_2.flatMap(({ token, r
|
|
|
51
48
|
limit: !hasBucket && remaining > 0 ? remaining : limit,
|
|
52
49
|
}));
|
|
53
50
|
}
|
|
54
|
-
return
|
|
51
|
+
return tsplus_module_1.map(() => void 0)(tsplus_module_1.collectAllParDiscard(effectsToRun));
|
|
55
52
|
})(store.hasBucket(bucket));
|
|
56
|
-
})(
|
|
53
|
+
})(Effect.fromOption(rateLimitFromHeaders(response.headers)));
|
|
57
54
|
})());
|
|
58
|
-
const request = (path, init = {}) =>
|
|
55
|
+
const request = (path, init = {}) => tsplus_module_1.catchTag("StatusCodeError", (e) => {
|
|
59
56
|
switch (e.code) {
|
|
60
57
|
case 403:
|
|
61
|
-
return
|
|
58
|
+
return tsplus_module_1.flatMap(() => Effect.fail(e))(tsplus_module_1.collectAllParDiscard([
|
|
62
59
|
log.info("DiscordREST", "403", path),
|
|
63
60
|
addBadRoute(routeFromConfig(path, init)),
|
|
64
61
|
updateBuckets(path, init, e.response),
|
|
65
62
|
]));
|
|
66
63
|
case 429:
|
|
67
|
-
return
|
|
64
|
+
return tsplus_module_1.flatMap(() => request(path, init))(tsplus_module_1.collectAllParDiscard([
|
|
68
65
|
log.info("DiscordREST", "429", path),
|
|
69
66
|
addBadRoute(routeFromConfig(path, init)),
|
|
70
67
|
updateBuckets(path, init, e.response),
|
|
71
|
-
|
|
68
|
+
Effect.sleep(tsplus_module_2.getOrElse(() => Duration.seconds(5))(retryAfter(e.response.headers))),
|
|
72
69
|
]));
|
|
73
70
|
}
|
|
74
|
-
return
|
|
75
|
-
})(
|
|
71
|
+
return Effect.fail(e);
|
|
72
|
+
})(tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(response => tsplus_module_1.map(() => response)(updateBuckets(path, init, response.response)))(http.requestWithJson(`${rest.baseUrl}${path}`, {
|
|
76
73
|
...init,
|
|
77
74
|
headers: {
|
|
78
75
|
...(init?.headers ?? {}),
|
|
@@ -80,7 +77,7 @@ const make = tsplus_module_2.flatMap(http => tsplus_module_2.flatMap(({ token, r
|
|
|
80
77
|
"User-Agent": `DiscordBot (https://github.com/tim-smart/dfx, ${Pkg.version})`,
|
|
81
78
|
},
|
|
82
79
|
})))(globalRateLimit))(requestRateLimit(path, init)));
|
|
83
|
-
const routes =
|
|
80
|
+
const routes = Discord.createRoutes(({ method, url, params, options = {}, }) => {
|
|
84
81
|
const hasBody = method !== "GET" && method !== "DELETE";
|
|
85
82
|
let hasFormData = typeof options?.body?.append === "function";
|
|
86
83
|
let body = undefined;
|
|
@@ -114,8 +111,8 @@ const make = tsplus_module_2.flatMap(http => tsplus_module_2.flatMap(({ token, r
|
|
|
114
111
|
});
|
|
115
112
|
});
|
|
116
113
|
return { request, ...routes };
|
|
117
|
-
})(
|
|
118
|
-
})(
|
|
119
|
-
export const DiscordREST =
|
|
120
|
-
export const LiveDiscordREST =
|
|
114
|
+
})(Ref.make(HashSet.empty()));
|
|
115
|
+
})(Effect.service(RateLimiter)))(Effect.service(RateLimitStore)))(Effect.service(Log.Log)))(Effect.service(Config.DiscordConfig)))(Effect.service(Http));
|
|
116
|
+
export const DiscordREST = Context.Tag();
|
|
117
|
+
export const LiveDiscordREST = Layer.fromEffect(DiscordREST)(make);
|
|
121
118
|
//# sourceMappingURL=index.js.map
|
package/DiscordREST/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/DiscordREST/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/DiscordREST/index.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAEL,MAAM,EAEN,IAAI,EAEJ,GAAG,EACH,WAAW,EACX,cAAc,GAEf,MAAM,KAAK,CAAA;AAEZ,OAAO,EACL,OAAO,EACP,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,KAAK,EACL,GAAG,GACJ,MAAM,aAAa,CAAA;AACpB,OAAO,GAAG,MAA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A;aACF;iBAAM,IAAI,WAAW,EAAE;gBACtB,IAAI,GAAG,OAAO,CAAC,IAAK,CAAA;gBACpB,IAAI,MAAM,EAAE;oBACV,CAAC;oBAAC,IAAiB,CAAC,MAAM,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;iBACnE;aACF;iBAAM,IAAI,MAAM,EAAE;gBACjB,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;aAC9B;iBAAM;gBACL,IAAI,GAAG,OAAO,CAAC,IAAK,CAAA;aACrB;YAED,OAAO,OAAO,CAAC,GAAG,GAAG,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE;gBACxC,MAAM;gBACN,OAAO;gBACP,IAAI;aACL,CAAC,CAAA;QACJ,CAAC,CACF,CAAA;QAED,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAAA;OA3KN,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAU,CAAC;GAThC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,GADnC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,GADhC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAFX,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,GAD/C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CA0LnC,CAAA;AAGF,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAe,CAAA;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAA"}
|
package/DiscordREST/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BlobError, FetchError, JsonParseError, StatusCodeError } from "dfx";
|
|
2
|
+
import { Effect } from "dfx/_common";
|
|
3
3
|
export interface ResponseWithData<A> {
|
|
4
4
|
response: Response;
|
|
5
|
-
json: Effect<never, JsonParseError, A>;
|
|
6
|
-
text: Effect<never, never, string>;
|
|
7
|
-
blob: Effect<never, BlobError, Blob>;
|
|
5
|
+
json: Effect.Effect<never, JsonParseError, A>;
|
|
6
|
+
text: Effect.Effect<never, never, string>;
|
|
7
|
+
blob: Effect.Effect<never, BlobError, Blob>;
|
|
8
8
|
}
|
|
9
|
-
export type RestResponse<T> = Effect<never, FetchError | StatusCodeError | JsonParseError, ResponseWithData<T>>;
|
|
9
|
+
export type RestResponse<T> = Effect.Effect<never, FetchError | StatusCodeError | JsonParseError, ResponseWithData<T>>;
|
package/DiscordREST/utils.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { Duration, Option } from "dfx/_common";
|
|
1
2
|
export declare const routeFromConfig: (path: string, init: RequestInit) => string;
|
|
2
|
-
export declare const numberHeader: (headers: Headers) => (key: string) =>
|
|
3
|
-
export declare const retryAfter: (headers: Headers) =>
|
|
4
|
-
export declare const rateLimitFromHeaders: (headers: Headers) =>
|
|
3
|
+
export declare const numberHeader: (headers: Headers) => (key: string) => Option.Option<number>;
|
|
4
|
+
export declare const retryAfter: (headers: Headers) => Option.Option<Duration.Duration>;
|
|
5
|
+
export declare const rateLimitFromHeaders: (headers: Headers) => Option.Option<{
|
|
5
6
|
readonly bucket: string;
|
|
6
|
-
readonly retryAfter:
|
|
7
|
+
readonly retryAfter: Duration.Duration;
|
|
7
8
|
readonly limit: number;
|
|
8
9
|
readonly remaining: number;
|
|
9
10
|
}>;
|