disgroove 1.3.3-dev.2 → 1.3.3-dev.3
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/dist/package.json +1 -1
- package/package.json +1 -1
- package/dist/lib/Client.d.ts +0 -234
- package/dist/lib/Client.js +0 -256
- package/dist/lib/Client.js.map +0 -1
- package/dist/lib/constants.d.ts +0 -1084
- package/dist/lib/constants.js +0 -1163
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/gateway/Shard.d.ts +0 -25
- package/dist/lib/gateway/Shard.js +0 -522
- package/dist/lib/gateway/Shard.js.map +0 -1
- package/dist/lib/gateway/ShardsManager.d.ts +0 -5
- package/dist/lib/gateway/ShardsManager.js +0 -13
- package/dist/lib/gateway/ShardsManager.js.map +0 -1
- package/dist/lib/gateway/index.d.ts +0 -2
- package/dist/lib/gateway/index.js +0 -19
- package/dist/lib/gateway/index.js.map +0 -1
- package/dist/lib/index.d.ts +0 -7
- package/dist/lib/index.js +0 -24
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/rest/CDN.d.ts +0 -21
- package/dist/lib/rest/CDN.js +0 -46
- package/dist/lib/rest/CDN.js.map +0 -1
- package/dist/lib/rest/Endpoints.d.ts +0 -94
- package/dist/lib/rest/Endpoints.js +0 -211
- package/dist/lib/rest/Endpoints.js.map +0 -1
- package/dist/lib/rest/REST.d.ts +0 -22
- package/dist/lib/rest/REST.js +0 -35
- package/dist/lib/rest/REST.js.map +0 -1
- package/dist/lib/rest/RequestsManager.d.ts +0 -17
- package/dist/lib/rest/RequestsManager.js +0 -124
- package/dist/lib/rest/RequestsManager.js.map +0 -1
- package/dist/lib/rest/index.d.ts +0 -4
- package/dist/lib/rest/index.js +0 -34
- package/dist/lib/rest/index.js.map +0 -1
- package/dist/lib/structures/Application.d.ts +0 -174
- package/dist/lib/structures/Application.js +0 -328
- package/dist/lib/structures/Application.js.map +0 -1
- package/dist/lib/structures/ApplicationCommand.d.ts +0 -45
- package/dist/lib/structures/ApplicationCommand.js +0 -127
- package/dist/lib/structures/ApplicationCommand.js.map +0 -1
- package/dist/lib/structures/AuditLog.d.ts +0 -20
- package/dist/lib/structures/AuditLog.js +0 -76
- package/dist/lib/structures/AuditLog.js.map +0 -1
- package/dist/lib/structures/AutoModerationRule.d.ts +0 -34
- package/dist/lib/structures/AutoModerationRule.js +0 -96
- package/dist/lib/structures/AutoModerationRule.js.map +0 -1
- package/dist/lib/structures/Base.d.ts +0 -17
- package/dist/lib/structures/Base.js +0 -31
- package/dist/lib/structures/Base.js.map +0 -1
- package/dist/lib/structures/Channel.d.ts +0 -253
- package/dist/lib/structures/Channel.js +0 -591
- package/dist/lib/structures/Channel.js.map +0 -1
- package/dist/lib/structures/ClientApplication.d.ts +0 -150
- package/dist/lib/structures/ClientApplication.js +0 -241
- package/dist/lib/structures/ClientApplication.js.map +0 -1
- package/dist/lib/structures/Emoji.d.ts +0 -28
- package/dist/lib/structures/Emoji.js +0 -79
- package/dist/lib/structures/Emoji.js.map +0 -1
- package/dist/lib/structures/Entitlement.d.ts +0 -24
- package/dist/lib/structures/Entitlement.js +0 -68
- package/dist/lib/structures/Entitlement.js.map +0 -1
- package/dist/lib/structures/Guild.d.ts +0 -462
- package/dist/lib/structures/Guild.js +0 -1095
- package/dist/lib/structures/Guild.js.map +0 -1
- package/dist/lib/structures/GuildMember.d.ts +0 -50
- package/dist/lib/structures/GuildMember.js +0 -149
- package/dist/lib/structures/GuildMember.js.map +0 -1
- package/dist/lib/structures/GuildScheduledEvent.d.ts +0 -49
- package/dist/lib/structures/GuildScheduledEvent.js +0 -118
- package/dist/lib/structures/GuildScheduledEvent.js.map +0 -1
- package/dist/lib/structures/GuildTemplate.d.ts +0 -32
- package/dist/lib/structures/GuildTemplate.js +0 -76
- package/dist/lib/structures/GuildTemplate.js.map +0 -1
- package/dist/lib/structures/Integration.d.ts +0 -30
- package/dist/lib/structures/Integration.js +0 -102
- package/dist/lib/structures/Integration.js.map +0 -1
- package/dist/lib/structures/Interaction.d.ts +0 -76
- package/dist/lib/structures/Interaction.js +0 -345
- package/dist/lib/structures/Interaction.js.map +0 -1
- package/dist/lib/structures/Invite.d.ts +0 -28
- package/dist/lib/structures/Invite.js +0 -86
- package/dist/lib/structures/Invite.js.map +0 -1
- package/dist/lib/structures/Message.d.ts +0 -84
- package/dist/lib/structures/Message.js +0 -300
- package/dist/lib/structures/Message.js.map +0 -1
- package/dist/lib/structures/Role.d.ts +0 -37
- package/dist/lib/structures/Role.js +0 -90
- package/dist/lib/structures/Role.js.map +0 -1
- package/dist/lib/structures/SKU.d.ts +0 -23
- package/dist/lib/structures/SKU.js +0 -63
- package/dist/lib/structures/SKU.js.map +0 -1
- package/dist/lib/structures/StageInstance.d.ts +0 -24
- package/dist/lib/structures/StageInstance.js +0 -57
- package/dist/lib/structures/StageInstance.js.map +0 -1
- package/dist/lib/structures/Sticker.d.ts +0 -31
- package/dist/lib/structures/Sticker.js +0 -86
- package/dist/lib/structures/Sticker.js.map +0 -1
- package/dist/lib/structures/Team.d.ts +0 -14
- package/dist/lib/structures/Team.js +0 -39
- package/dist/lib/structures/Team.js.map +0 -1
- package/dist/lib/structures/TestEntitlement.d.ts +0 -23
- package/dist/lib/structures/TestEntitlement.js +0 -61
- package/dist/lib/structures/TestEntitlement.js.map +0 -1
- package/dist/lib/structures/UnavailableGuild.d.ts +0 -11
- package/dist/lib/structures/UnavailableGuild.js +0 -25
- package/dist/lib/structures/UnavailableGuild.js.map +0 -1
- package/dist/lib/structures/User.d.ts +0 -63
- package/dist/lib/structures/User.js +0 -177
- package/dist/lib/structures/User.js.map +0 -1
- package/dist/lib/structures/VoiceState.d.ts +0 -26
- package/dist/lib/structures/VoiceState.js +0 -70
- package/dist/lib/structures/VoiceState.js.map +0 -1
- package/dist/lib/structures/Webhook.d.ts +0 -84
- package/dist/lib/structures/Webhook.js +0 -239
- package/dist/lib/structures/Webhook.js.map +0 -1
- package/dist/lib/structures/index.d.ts +0 -27
- package/dist/lib/structures/index.js +0 -44
- package/dist/lib/structures/index.js.map +0 -1
- package/dist/lib/types/application-command.d.ts +0 -102
- package/dist/lib/types/application-command.js +0 -3
- package/dist/lib/types/application-command.js.map +0 -1
- package/dist/lib/types/application-role-connection-metadata.d.ts +0 -18
- package/dist/lib/types/application-role-connection-metadata.js +0 -3
- package/dist/lib/types/application-role-connection-metadata.js.map +0 -1
- package/dist/lib/types/application.d.ts +0 -66
- package/dist/lib/types/application.js +0 -3
- package/dist/lib/types/application.js.map +0 -1
- package/dist/lib/types/audit-log.d.ts +0 -82
- package/dist/lib/types/audit-log.js +0 -3
- package/dist/lib/types/audit-log.js.map +0 -1
- package/dist/lib/types/auto-moderation.d.ts +0 -65
- package/dist/lib/types/auto-moderation.js +0 -3
- package/dist/lib/types/auto-moderation.js.map +0 -1
- package/dist/lib/types/channel.d.ts +0 -456
- package/dist/lib/types/channel.js +0 -3
- package/dist/lib/types/channel.js.map +0 -1
- package/dist/lib/types/emoji.d.ts +0 -22
- package/dist/lib/types/emoji.js +0 -3
- package/dist/lib/types/emoji.js.map +0 -1
- package/dist/lib/types/entitlements.d.ts +0 -32
- package/dist/lib/types/entitlements.js +0 -3
- package/dist/lib/types/entitlements.js.map +0 -1
- package/dist/lib/types/gateway-events.d.ts +0 -805
- package/dist/lib/types/gateway-events.js +0 -3
- package/dist/lib/types/gateway-events.js.map +0 -1
- package/dist/lib/types/guild-scheduled-event.d.ts +0 -57
- package/dist/lib/types/guild-scheduled-event.js +0 -3
- package/dist/lib/types/guild-scheduled-event.js.map +0 -1
- package/dist/lib/types/guild-template.d.ts +0 -28
- package/dist/lib/types/guild-template.js +0 -3
- package/dist/lib/types/guild-template.js.map +0 -1
- package/dist/lib/types/guild.d.ts +0 -333
- package/dist/lib/types/guild.js +0 -3
- package/dist/lib/types/guild.js.map +0 -1
- package/dist/lib/types/index.d.ts +0 -23
- package/dist/lib/types/index.js +0 -40
- package/dist/lib/types/index.js.map +0 -1
- package/dist/lib/types/interaction.d.ts +0 -170
- package/dist/lib/types/interaction.js +0 -3
- package/dist/lib/types/interaction.js.map +0 -1
- package/dist/lib/types/invite.d.ts +0 -59
- package/dist/lib/types/invite.js +0 -3
- package/dist/lib/types/invite.js.map +0 -1
- package/dist/lib/types/message-components.d.ts +0 -100
- package/dist/lib/types/message-components.js +0 -3
- package/dist/lib/types/message-components.js.map +0 -1
- package/dist/lib/types/role.d.ts +0 -47
- package/dist/lib/types/role.js +0 -3
- package/dist/lib/types/role.js.map +0 -1
- package/dist/lib/types/sku.d.ts +0 -30
- package/dist/lib/types/sku.js +0 -3
- package/dist/lib/types/sku.js.map +0 -1
- package/dist/lib/types/stage-instance.d.ts +0 -20
- package/dist/lib/types/stage-instance.js +0 -3
- package/dist/lib/types/stage-instance.js.map +0 -1
- package/dist/lib/types/sticker.d.ts +0 -61
- package/dist/lib/types/sticker.js +0 -3
- package/dist/lib/types/sticker.js.map +0 -1
- package/dist/lib/types/team.d.ts +0 -30
- package/dist/lib/types/team.js +0 -3
- package/dist/lib/types/team.js.map +0 -1
- package/dist/lib/types/user.d.ts +0 -77
- package/dist/lib/types/user.js +0 -3
- package/dist/lib/types/user.js.map +0 -1
- package/dist/lib/types/voice.d.ts +0 -47
- package/dist/lib/types/voice.js +0 -3
- package/dist/lib/types/voice.js.map +0 -1
- package/dist/lib/types/webhook.d.ts +0 -31
- package/dist/lib/types/webhook.js +0 -3
- package/dist/lib/types/webhook.js.map +0 -1
- package/dist/lib/utils/Util.d.ts +0 -15
- package/dist/lib/utils/Util.js +0 -543
- package/dist/lib/utils/Util.js.map +0 -1
- package/dist/lib/utils/errors.d.ts +0 -12
- package/dist/lib/utils/errors.js +0 -25
- package/dist/lib/utils/errors.js.map +0 -1
- package/dist/lib/utils/index.d.ts +0 -2
- package/dist/lib/utils/index.js +0 -19
- package/dist/lib/utils/index.js.map +0 -1
- package/examples/applicationCommands.js +0 -43
- package/examples/buttons.js +0 -70
- package/examples/embeds.js +0 -36
- package/examples/ephemeralMessages.js +0 -32
- package/examples/files.js +0 -36
- package/examples/modalSubmit.js +0 -62
- package/examples/permissions.js +0 -41
- package/examples/selectMenus.js +0 -160
- package/examples/text.txt +0 -1
- package/lib/Client.ts +0 -616
- package/lib/constants.ts +0 -1173
- package/lib/gateway/Shard.ts +0 -704
- package/lib/gateway/ShardsManager.ts +0 -11
- package/lib/gateway/index.ts +0 -2
- package/lib/index.ts +0 -7
- package/lib/rest/CDN.ts +0 -56
- package/lib/rest/Endpoints.ts +0 -241
- package/lib/rest/REST.ts +0 -45
- package/lib/rest/RequestsManager.ts +0 -134
- package/lib/rest/index.ts +0 -4
- package/lib/structures/Application.ts +0 -599
- package/lib/structures/ApplicationCommand.ts +0 -187
- package/lib/structures/AuditLog.ts +0 -112
- package/lib/structures/AutoModerationRule.ts +0 -127
- package/lib/structures/Base.ts +0 -39
- package/lib/structures/Channel.ts +0 -921
- package/lib/structures/ClientApplication.ts +0 -515
- package/lib/structures/Emoji.ts +0 -95
- package/lib/structures/Entitlement.ts +0 -65
- package/lib/structures/Guild.ts +0 -1842
- package/lib/structures/GuildMember.ts +0 -193
- package/lib/structures/GuildScheduledEvent.ts +0 -164
- package/lib/structures/GuildTemplate.ts +0 -103
- package/lib/structures/Integration.ts +0 -136
- package/lib/structures/Interaction.ts +0 -506
- package/lib/structures/Invite.ts +0 -108
- package/lib/structures/Message.ts +0 -421
- package/lib/structures/Role.ts +0 -116
- package/lib/structures/SKU.ts +0 -63
- package/lib/structures/StageInstance.ts +0 -74
- package/lib/structures/Sticker.ts +0 -100
- package/lib/structures/Team.ts +0 -41
- package/lib/structures/TestEntitlement.ts +0 -78
- package/lib/structures/UnavailableGuild.ts +0 -27
- package/lib/structures/User.ts +0 -233
- package/lib/structures/VoiceState.ts +0 -72
- package/lib/structures/Webhook.ts +0 -341
- package/lib/structures/index.ts +0 -27
- package/lib/types/application-command.ts +0 -118
- package/lib/types/application-role-connection-metadata.ts +0 -23
- package/lib/types/application.ts +0 -77
- package/lib/types/audit-log.ts +0 -105
- package/lib/types/auto-moderation.ts +0 -78
- package/lib/types/channel.ts +0 -534
- package/lib/types/emoji.ts +0 -24
- package/lib/types/entitlements.ts +0 -34
- package/lib/types/gateway-events.ts +0 -970
- package/lib/types/guild-scheduled-event.ts +0 -67
- package/lib/types/guild-template.ts +0 -30
- package/lib/types/guild.ts +0 -388
- package/lib/types/index.ts +0 -23
- package/lib/types/interaction.ts +0 -224
- package/lib/types/invite.ts +0 -78
- package/lib/types/message-components.ts +0 -127
- package/lib/types/role.ts +0 -51
- package/lib/types/sku.ts +0 -32
- package/lib/types/stage-instance.ts +0 -22
- package/lib/types/sticker.ts +0 -67
- package/lib/types/team.ts +0 -34
- package/lib/types/user.ts +0 -93
- package/lib/types/voice.ts +0 -51
- package/lib/types/webhook.ts +0 -40
- package/lib/utils/Util.ts +0 -600
- package/lib/utils/errors.ts +0 -23
- package/lib/utils/index.ts +0 -2
- package/test/basic.js +0 -8
- package/tsconfig.json +0 -107
package/lib/index.ts
DELETED
package/lib/rest/CDN.ts
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
export const achievementIcon = (
|
2
|
-
applicationId: string,
|
3
|
-
achievementId: string,
|
4
|
-
iconHash: string
|
5
|
-
) =>
|
6
|
-
`app-assets/${applicationId}/achievements/${achievementId}/icons/${iconHash}.png` as const;
|
7
|
-
export const applicationAsset = (applicationId: string, assetId: string) =>
|
8
|
-
`app-assets/${applicationId}/${assetId}.png` as const;
|
9
|
-
export const applicationCover = (applicationId: string, coverImage: string) =>
|
10
|
-
`app-icons/${applicationId}/${coverImage}.png` as const;
|
11
|
-
export const applicationIcon = (applicationId: string, icon: string) =>
|
12
|
-
`app-icons/${applicationId}/${icon}.png` as const;
|
13
|
-
export const customEmoji = (emojiId: string) =>
|
14
|
-
`emojis/${emojiId}.png` as const;
|
15
|
-
export const defaultUserAvatar = (index: string) =>
|
16
|
-
`embed/avatars/${index}.png` as const;
|
17
|
-
export const guildBanner = (guildId: string, banner: string) =>
|
18
|
-
`banners/${guildId}/${banner}.png` as const;
|
19
|
-
export const guildDiscoverySplash = (guildId: string, splash: string) =>
|
20
|
-
`discovery-splashes/${guildId}/${splash}.png` as const;
|
21
|
-
export const guildIcon = (guildId: string, icon: string) =>
|
22
|
-
`icons/${guildId}/${icon}.png` as const;
|
23
|
-
export const guildMemberAvatar = (
|
24
|
-
guildId: string,
|
25
|
-
userId: string,
|
26
|
-
avatar: string
|
27
|
-
) => `guilds/${guildId}/users/${userId}/avatars/${avatar}.png` as const;
|
28
|
-
export const guildMemberBanner = (
|
29
|
-
guildId: string,
|
30
|
-
userId: string,
|
31
|
-
banner: string
|
32
|
-
) => `guilds/${guildId}/users/${userId}/banners/${banner}.png` as const;
|
33
|
-
export const guildScheduledEventCover = (
|
34
|
-
scheduledEventId: string,
|
35
|
-
coverImage: string
|
36
|
-
) => `guild-events/${scheduledEventId}/${coverImage}.png` as const;
|
37
|
-
export const guildSplash = (guildId: string, splash: string) =>
|
38
|
-
`splashes/${guildId}/${splash}.png` as const;
|
39
|
-
export const roleIcon = (roleId: string, icon: string) =>
|
40
|
-
`role-icons/${roleId}/${icon}.png` as const;
|
41
|
-
export const stickerPackBanner = (assetId: string) =>
|
42
|
-
`app-assets/710982414301790216/store/${assetId}.png` as const;
|
43
|
-
export const sticker = (stickerId: string) =>
|
44
|
-
`stickers/${stickerId}.png` as const;
|
45
|
-
export const storePageAsset = (applicationId: string, assetId: string) =>
|
46
|
-
`app-assets/${applicationId}/store/${assetId}` as const;
|
47
|
-
export const teamIcon = (teamId: string, icon: string) =>
|
48
|
-
`team-icons/${teamId}/${icon}.png` as const;
|
49
|
-
export const userAvatar = (userId: string, avatar: string) =>
|
50
|
-
`avatars/${userId}/${avatar}.png` as const;
|
51
|
-
export const userAvatarDecoration = (
|
52
|
-
userId: string,
|
53
|
-
avatarDecoration: string
|
54
|
-
) => `avatar-decorations/${userId}/${avatarDecoration}.png` as const;
|
55
|
-
export const userBanner = (userId: string, banner: string) =>
|
56
|
-
`banners/${userId}/${banner}.png` as const;
|
package/lib/rest/Endpoints.ts
DELETED
@@ -1,241 +0,0 @@
|
|
1
|
-
// Guilds
|
2
|
-
export const guild = (guildId: string) => `guilds/${guildId}` as const;
|
3
|
-
export const guilds = () => "guilds" as const;
|
4
|
-
export const guildActiveThreads = (guildId: string) =>
|
5
|
-
`guilds/${guildId}/threads/active` as const;
|
6
|
-
export const guildAuditLog = (guildId: string) =>
|
7
|
-
`guilds/${guildId}/audit-logs` as const;
|
8
|
-
export const guildAutoModerationRule = (guildId: string, ruleId: string) =>
|
9
|
-
`guilds/${guildId}/auto-moderation/rules/${ruleId}` as const;
|
10
|
-
export const guildAutoModerationRules = (guildId: string) =>
|
11
|
-
`guilds/${guildId}/auto-moderation/rules` as const;
|
12
|
-
export const guildBan = (guildId: string, userId: string) =>
|
13
|
-
`guilds/${guildId}/bans/${userId}` as const;
|
14
|
-
export const guildBans = (guildId: string) => `guilds/${guildId}/bans` as const;
|
15
|
-
export const guildChannels = (guildId: string) =>
|
16
|
-
`guilds/${guildId}/channels` as const;
|
17
|
-
export const guildCurrentMemberNickname = (guildId: string) =>
|
18
|
-
`guilds/${guildId}/members/@me/nick` as const;
|
19
|
-
export const guildEmoji = (guildId: string, emojiId: string) =>
|
20
|
-
`guilds/${guildId}/emojis/${emojiId}` as const;
|
21
|
-
export const guildEmojis = (guildId: string) =>
|
22
|
-
`guilds/${guildId}/emojis` as const;
|
23
|
-
export const guildIntegration = (guildId: string, integrationId: string) =>
|
24
|
-
`guilds/${guildId}/integrations/${integrationId}` as const;
|
25
|
-
export const guildIntegrations = (guildId: string) =>
|
26
|
-
`guilds/${guildId}/integrations` as const;
|
27
|
-
export const guildInvites = (guildId: string) =>
|
28
|
-
`guilds/${guildId}/invites` as const;
|
29
|
-
export const guildMFA = (guildId: string) => `guilds/${guildId}/mfa` as const;
|
30
|
-
export const guildMember = (guildId: string, userId: string | "@me" = "@me") =>
|
31
|
-
`guilds/${guildId}/members/${userId}` as const;
|
32
|
-
export const guildMemberRole = (
|
33
|
-
guildId: string,
|
34
|
-
memberId: string,
|
35
|
-
roleId: string
|
36
|
-
) => `guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
|
37
|
-
export const guildMembers = (guildId: string) =>
|
38
|
-
`guilds/${guildId}/members` as const;
|
39
|
-
export const guildMembersSearch = (guildId: string) =>
|
40
|
-
`guilds/${guildId}/members/search` as const;
|
41
|
-
export const guildMemberVerification = (guildId: string) =>
|
42
|
-
`guilds/${guildId}/member-verification` as const;
|
43
|
-
export const guildOnboarding = (guildId: string) =>
|
44
|
-
`guilds/${guildId}/onboarding` as const;
|
45
|
-
export const guildPreview = (guildId: string) =>
|
46
|
-
`guilds/${guildId}/preview` as const;
|
47
|
-
export const guildPrune = (guildId: string) =>
|
48
|
-
`guilds/${guildId}/prune` as const;
|
49
|
-
export const guildRole = (guildId: string, roleId: string) =>
|
50
|
-
`guilds/${guildId}/roles/${roleId}` as const;
|
51
|
-
export const guildRoles = (guildId: string) =>
|
52
|
-
`guilds/${guildId}/roles` as const;
|
53
|
-
export const guildScheduledEvent = (
|
54
|
-
guildId: string,
|
55
|
-
guildScheduledEventId: string
|
56
|
-
) => `guilds/${guildId}/scheduled-events/${guildScheduledEventId}` as const;
|
57
|
-
export const guildScheduledEvents = (guildId: string) =>
|
58
|
-
`guilds/${guildId}/scheduled-events` as const;
|
59
|
-
export const guildScheduledEventUsers = (
|
60
|
-
guildId: string,
|
61
|
-
guildScheduledEventId: string
|
62
|
-
) =>
|
63
|
-
`guilds/${guildId}/scheduled-events/${guildScheduledEventId}/users` as const;
|
64
|
-
export const guildSticker = (guildId: string, stickerId: string) =>
|
65
|
-
`guilds/${guildId}/stickers/${stickerId}` as const;
|
66
|
-
export const guildStickers = (guildId: string) =>
|
67
|
-
`guilds/${guildId}/stickers` as const;
|
68
|
-
export const guildTemplate = (guildId: string, code: string) =>
|
69
|
-
`guilds/${guildId}/templates/${code}` as const;
|
70
|
-
export const guildTemplates = (guildId: string) =>
|
71
|
-
`guilds/${guildId}/templates` as const;
|
72
|
-
export const guildVanityURL = (guildId: string) =>
|
73
|
-
`guilds/${guildId}/vanity-url` as const;
|
74
|
-
export const guildVoiceRegions = (guildId: string) =>
|
75
|
-
`guilds/${guildId}/regions` as const;
|
76
|
-
export const guildVoiceState = (
|
77
|
-
guildId: string,
|
78
|
-
userId: string | "@me" = "@me"
|
79
|
-
) => `guilds/${guildId}/voice-states/${userId}` as const;
|
80
|
-
export const guildWebhooks = (guildId: string) =>
|
81
|
-
`guilds/${guildId}/webhooks` as const;
|
82
|
-
export const guildWelcomeScreen = (guildId: string) =>
|
83
|
-
`guilds/${guildId}/welcome-screen` as const;
|
84
|
-
export const guildWidgetImage = (guildId: string) =>
|
85
|
-
`guilds/${guildId}/widget.png` as const;
|
86
|
-
|
87
|
-
export const guildWidgetJSON = (guildId: string) =>
|
88
|
-
`guilds/${guildId}/widget.json` as const;
|
89
|
-
export const guildWidgetSettings = (guildId: string) =>
|
90
|
-
`guilds/${guildId}/widget` as const;
|
91
|
-
export const template = (code: string) => `guilds/templates/${code}` as const;
|
92
|
-
|
93
|
-
// Channels
|
94
|
-
export const channel = (channelId: string) => `channels/${channelId}` as const;
|
95
|
-
export const channelBulkDelete = (channelId: string) =>
|
96
|
-
`channels/${channelId}/messages/bulk-delete` as const;
|
97
|
-
export const channelFollowers = (channelId: string) =>
|
98
|
-
`channels/${channelId}/followers` as const;
|
99
|
-
export const channelInvites = (channelId: string) =>
|
100
|
-
`channels/${channelId}/invites` as const;
|
101
|
-
export const channelMessage = (channelId: string, messageId: string) =>
|
102
|
-
`channels/${channelId}/messages/${messageId}` as const;
|
103
|
-
export const channelMessageAllReactions = (
|
104
|
-
channelId: string,
|
105
|
-
messageId: string,
|
106
|
-
emoji?: string
|
107
|
-
) =>
|
108
|
-
emoji
|
109
|
-
? (`channels/${channelId}/messages/${messageId}/reactions/${emoji}` as const)
|
110
|
-
: (`channels/${channelId}/messages/${messageId}/reactions` as const);
|
111
|
-
export const channelMessageCrosspost = (channelId: string, messageId: string) =>
|
112
|
-
`channels/${channelId}/messages/${messageId}/crosspost` as const;
|
113
|
-
export const channelMessageReaction = (
|
114
|
-
channelId: string,
|
115
|
-
messageId: string,
|
116
|
-
emoji: string,
|
117
|
-
userId: string | "@me" = "@me"
|
118
|
-
) =>
|
119
|
-
`channels/${channelId}/messages/${messageId}/reactions/${emoji}/${userId}` as const;
|
120
|
-
export const channelMessages = (channelId: string) =>
|
121
|
-
`channels/${channelId}/messages` as const;
|
122
|
-
export const channelPermission = (channelId: string, overwriteId: string) =>
|
123
|
-
`channels/${channelId}/permissions/${overwriteId}` as const;
|
124
|
-
export const channelPin = (channelId: string, messageId: string) =>
|
125
|
-
`channels/${channelId}/pins/${messageId}` as const;
|
126
|
-
export const channelPins = (channelId: string) =>
|
127
|
-
`channels/${channelId}/pins` as const;
|
128
|
-
export const channelRecipient = (channelId: string, userId: string) =>
|
129
|
-
`channels/${channelId}/recipients/${userId}` as const;
|
130
|
-
export const channelThreads = (
|
131
|
-
channelId: string,
|
132
|
-
archivedStatus: "public" | "private",
|
133
|
-
joined: boolean
|
134
|
-
) =>
|
135
|
-
joined
|
136
|
-
? (`channels/${channelId}/users/@me/threads/archived/${archivedStatus}` as const)
|
137
|
-
: (`channels/${channelId}/threads/archived/${archivedStatus}` as const);
|
138
|
-
export const channelTyping = (channelId: string) =>
|
139
|
-
`channels/${channelId}/typing` as const;
|
140
|
-
export const channelWebhooks = (channelId: string) =>
|
141
|
-
`channels/${channelId}/webhooks` as const;
|
142
|
-
export const threads = (channelId: string, messageId?: string) =>
|
143
|
-
messageId
|
144
|
-
? (`channels/${channelId}/messages/${messageId}/threads` as const)
|
145
|
-
: (`channels/${channelId}/threads` as const);
|
146
|
-
export const threadMembers = (threadId: string, userId?: string | "@me") =>
|
147
|
-
userId
|
148
|
-
? (`channels/${threadId}/thread-members` as const)
|
149
|
-
: (`channels/${threadId}/thread-members/${userId}` as const);
|
150
|
-
|
151
|
-
// Users
|
152
|
-
export const user = (userId: string | "@me" = "@me") =>
|
153
|
-
`users/${userId}` as const;
|
154
|
-
export const userApplicationRoleConnection = (applicationId: string) =>
|
155
|
-
`users/@me/applications/${applicationId}/role-connection` as const;
|
156
|
-
export const userChannels = () => "users/@me/channels" as const;
|
157
|
-
export const userConnections = () => "users/@me/connections" as const;
|
158
|
-
export const userGuild = (guildId: string) =>
|
159
|
-
`users/@me/guilds/${guildId}` as const;
|
160
|
-
export const userGuilds = () => "users/@me/guilds" as const;
|
161
|
-
|
162
|
-
// Applications
|
163
|
-
|
164
|
-
export const applicationCommand = (applicationId: string, commandId: string) =>
|
165
|
-
`applications/${applicationId}/commands/${commandId}` as const;
|
166
|
-
export const applicationCommands = (applicationId: string) =>
|
167
|
-
`applications/${applicationId}/commands` as const;
|
168
|
-
export const applicationCommandPermissions = (
|
169
|
-
applicationId: string,
|
170
|
-
guildId: string,
|
171
|
-
commandId: string
|
172
|
-
) =>
|
173
|
-
`applications/${applicationId}/guilds/${guildId}/commands/${commandId}/permissions` as const;
|
174
|
-
export const applicationCurrentUser = () => "applications/@me" as const;
|
175
|
-
export const applicationEntitlement = (
|
176
|
-
applicationId: string,
|
177
|
-
entitlementId: string
|
178
|
-
) => `applications/${applicationId}/entitlements/${entitlementId}` as const;
|
179
|
-
export const applicationEntitlements = (applicationId: string) =>
|
180
|
-
`applications/${applicationId}/entitlements` as const;
|
181
|
-
export const applicationGuildCommand = (
|
182
|
-
applicationId: string,
|
183
|
-
guildId: string,
|
184
|
-
commandId: string
|
185
|
-
) =>
|
186
|
-
`applications/${applicationId}/guilds/${guildId}/commands/${commandId}` as const;
|
187
|
-
export const applicationGuildCommands = (
|
188
|
-
applicationId: string,
|
189
|
-
guildId: string
|
190
|
-
) => `applications/${applicationId}/guilds/${guildId}/commands` as const;
|
191
|
-
export const applicationRoleConnectionMetadata = (applicationId: string) =>
|
192
|
-
`applications/${applicationId}/role-connections/metadata` as const;
|
193
|
-
export const applicationSKUs = (applicationId: string) =>
|
194
|
-
`applications/${applicationId}/skus` as const;
|
195
|
-
export const guildApplicationCommandsPermissions = (
|
196
|
-
applicationId: string,
|
197
|
-
guildId: string
|
198
|
-
) =>
|
199
|
-
`applications/${applicationId}/guilds/${guildId}/commands/permissions` as const;
|
200
|
-
|
201
|
-
// Webhooks
|
202
|
-
export const webhook = (webhookId: string, webhookToken?: string) =>
|
203
|
-
webhookToken
|
204
|
-
? (`webhooks/${webhookId}/${webhookToken}` as const)
|
205
|
-
: (`webhooks/${webhookId}` as const);
|
206
|
-
export const webhookMessage = (
|
207
|
-
webhookId: string,
|
208
|
-
webhookToken: string,
|
209
|
-
messageId: string | "@original" = "@original"
|
210
|
-
) => `webhooks/${webhookId}/${webhookToken}/messages/${messageId}` as const;
|
211
|
-
export const webhookPlatform = (
|
212
|
-
webhookId: string,
|
213
|
-
webhookToken: string,
|
214
|
-
platform: "github" | "slack"
|
215
|
-
) => `webhooks/${webhookId}/${webhookToken}/${platform}` as const;
|
216
|
-
|
217
|
-
// Gateway
|
218
|
-
export const gateway = () => "gateway" as const;
|
219
|
-
export const gatewayBot = () => "gateway/bot" as const;
|
220
|
-
|
221
|
-
// OAuth2
|
222
|
-
export const oauth2Authorization = () => "oauth2/authorize" as const;
|
223
|
-
|
224
|
-
export const oauth2CurrentApplication = () =>
|
225
|
-
`oauth2/applications/@me` as const;
|
226
|
-
export const oauth2CurrentAuthorization = () => "oauth2/@me" as const;
|
227
|
-
export const oauth2TokenExchange = () => "oauth2/token" as const;
|
228
|
-
export const oauth2TokenRevocation = () => "oauth2/token/revoke" as const;
|
229
|
-
|
230
|
-
// Misc
|
231
|
-
export const interactionCallback = (
|
232
|
-
interactionId: string,
|
233
|
-
interactionToken: string
|
234
|
-
) => `interactions/${interactionId}/${interactionToken}/callback` as const;
|
235
|
-
export const invite = (code: string) => `invites/${code}` as const;
|
236
|
-
export const stageInstance = (channelId: string) =>
|
237
|
-
`stage-instances/${channelId}` as const;
|
238
|
-
export const stageInstances = () => "stage-instances" as const;
|
239
|
-
export const sticker = (stickerId: string) => `stickers/${stickerId}` as const;
|
240
|
-
export const stickerPacks = () => "sticker-packs" as const;
|
241
|
-
export const voiceRegions = () => "voice/regions" as const;
|
package/lib/rest/REST.ts
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
import { RequestData, RequestsManager } from ".";
|
2
|
-
|
3
|
-
export interface File {
|
4
|
-
contents: Buffer;
|
5
|
-
name: string;
|
6
|
-
}
|
7
|
-
|
8
|
-
export enum RESTMethods {
|
9
|
-
Get = "GET",
|
10
|
-
Post = "POST",
|
11
|
-
Delete = "DELETE",
|
12
|
-
Patch = "PATCH",
|
13
|
-
Put = "PUT",
|
14
|
-
}
|
15
|
-
|
16
|
-
export class REST {
|
17
|
-
manager: RequestsManager;
|
18
|
-
|
19
|
-
constructor(token: string, auth: "Bot" | "Bearer") {
|
20
|
-
this.manager = new RequestsManager(token, auth);
|
21
|
-
}
|
22
|
-
|
23
|
-
get<T>(
|
24
|
-
endpoint: string,
|
25
|
-
data?: Pick<RequestData, "query" | "authorization">
|
26
|
-
): Promise<T> {
|
27
|
-
return this.manager.request<T>(RESTMethods.Get, endpoint, data);
|
28
|
-
}
|
29
|
-
|
30
|
-
post<T>(endpoint: string, data?: RequestData): Promise<T> {
|
31
|
-
return this.manager.request<T>(RESTMethods.Post, endpoint, data);
|
32
|
-
}
|
33
|
-
|
34
|
-
delete<T>(endpoint: string, data?: RequestData): Promise<T> {
|
35
|
-
return this.manager.request<T>(RESTMethods.Delete, endpoint, data);
|
36
|
-
}
|
37
|
-
|
38
|
-
patch<T>(endpoint: string, data?: RequestData): Promise<T> {
|
39
|
-
return this.manager.request<T>(RESTMethods.Patch, endpoint, data);
|
40
|
-
}
|
41
|
-
|
42
|
-
put<T>(endpoint: string, data?: RequestData): Promise<T> {
|
43
|
-
return this.manager.request<T>(RESTMethods.Put, endpoint, data);
|
44
|
-
}
|
45
|
-
}
|
@@ -1,134 +0,0 @@
|
|
1
|
-
import { File, RESTMethods } from ".";
|
2
|
-
import { fetch, FormData, File as UndiciFile } from "undici";
|
3
|
-
import { HTTPResponseCodes } from "../constants";
|
4
|
-
import { HTTPError, RESTError } from "../utils";
|
5
|
-
import * as pkg from "../../package.json";
|
6
|
-
|
7
|
-
export interface RequestData {
|
8
|
-
json?: unknown;
|
9
|
-
form?: FormData;
|
10
|
-
files?: Array<File> | null;
|
11
|
-
reason?: string;
|
12
|
-
query?: Partial<Record<string, string | number | boolean | Array<string>>>;
|
13
|
-
authorization?: boolean;
|
14
|
-
}
|
15
|
-
|
16
|
-
export class RequestsManager {
|
17
|
-
token: string;
|
18
|
-
auth: "Bot" | "Bearer";
|
19
|
-
globalBlock: boolean = false;
|
20
|
-
|
21
|
-
constructor(token: string, auth: "Bot" | "Bearer") {
|
22
|
-
this.token = token;
|
23
|
-
this.auth = auth;
|
24
|
-
}
|
25
|
-
|
26
|
-
request<T = unknown>(
|
27
|
-
method: RESTMethods,
|
28
|
-
endpoint: string,
|
29
|
-
data?: RequestData
|
30
|
-
): Promise<T> {
|
31
|
-
return new Promise<T>(async (resolve, reject) => {
|
32
|
-
if (this.globalBlock && !endpoint.startsWith("interactions")) return;
|
33
|
-
|
34
|
-
let url: URL = new URL(`https://discord.com/api/v10/${endpoint}`);
|
35
|
-
|
36
|
-
if (data?.query)
|
37
|
-
for (const [key, value] of Object.entries(data.query))
|
38
|
-
if (value !== undefined) url.searchParams.set(key, String(value));
|
39
|
-
|
40
|
-
let headers: Record<string, string> = {
|
41
|
-
"User-Agent": `DiscordBot (https://github.com/XenKys/disgroove, ${pkg.version})`,
|
42
|
-
Authorization: `${this.auth} ${this.token}`,
|
43
|
-
};
|
44
|
-
let body: string | FormData | undefined;
|
45
|
-
|
46
|
-
if (data?.authorization === false) delete headers["Authorization"];
|
47
|
-
|
48
|
-
if (method !== RESTMethods.Get) {
|
49
|
-
if (data?.form || (data?.files && data?.files?.length !== 0)) {
|
50
|
-
const formData = data.form ?? new FormData();
|
51
|
-
|
52
|
-
if (data?.files && data?.files?.length !== 0) {
|
53
|
-
for (let i = 0; i < data?.files.length; i++) {
|
54
|
-
const file = data?.files[i];
|
55
|
-
|
56
|
-
formData?.set(
|
57
|
-
`files[${i}]`,
|
58
|
-
new UndiciFile([file.contents], file.name)
|
59
|
-
);
|
60
|
-
}
|
61
|
-
|
62
|
-
if (data?.json)
|
63
|
-
formData?.set("payload_json", JSON.stringify(data?.json));
|
64
|
-
}
|
65
|
-
|
66
|
-
body = formData;
|
67
|
-
} else {
|
68
|
-
body = JSON.stringify(data?.json);
|
69
|
-
|
70
|
-
headers["Content-Type"] = "application/json";
|
71
|
-
}
|
72
|
-
|
73
|
-
if (data?.reason !== undefined)
|
74
|
-
headers["X-Audit-Log-Reason"] = data?.reason;
|
75
|
-
}
|
76
|
-
|
77
|
-
try {
|
78
|
-
const response = await fetch(url.href, {
|
79
|
-
method,
|
80
|
-
body,
|
81
|
-
headers,
|
82
|
-
});
|
83
|
-
|
84
|
-
if (response.headers.has("X-RateLimit-Global")) {
|
85
|
-
this.globalBlock = true;
|
86
|
-
|
87
|
-
setTimeout(() => {
|
88
|
-
this.globalBlock = false;
|
89
|
-
}, Number(response.headers.get("Retry-After")) * 1000);
|
90
|
-
}
|
91
|
-
|
92
|
-
if (response.status >= HTTPResponseCodes.NotModified) {
|
93
|
-
if (response.status === HTTPResponseCodes.TooManyRequests) {
|
94
|
-
setTimeout(
|
95
|
-
() =>
|
96
|
-
this.request<T>(method, endpoint, data)
|
97
|
-
.then(resolve)
|
98
|
-
.catch(reject),
|
99
|
-
Number(response.headers.get("Retry-After")) * 1000
|
100
|
-
);
|
101
|
-
} else if (response.status === HTTPResponseCodes.GatewayUnavailable) {
|
102
|
-
setTimeout(
|
103
|
-
() =>
|
104
|
-
this.request<T>(method, endpoint, data)
|
105
|
-
.then(resolve)
|
106
|
-
.catch(reject),
|
107
|
-
5 * 1000
|
108
|
-
);
|
109
|
-
} else {
|
110
|
-
const responseJSON = await response.json();
|
111
|
-
|
112
|
-
reject(
|
113
|
-
responseJSON &&
|
114
|
-
typeof responseJSON === "object" &&
|
115
|
-
"code" in responseJSON &&
|
116
|
-
"message" in responseJSON &&
|
117
|
-
responseJSON.code !== 0
|
118
|
-
? new RESTError(
|
119
|
-
`[${responseJSON.code}] ${responseJSON.message}`
|
120
|
-
)
|
121
|
-
: new HTTPError(`[${response.status}] ${response.statusText}`)
|
122
|
-
);
|
123
|
-
}
|
124
|
-
} else if (response.status === HTTPResponseCodes.NoContent) {
|
125
|
-
resolve(null as T);
|
126
|
-
} else {
|
127
|
-
resolve((await response.json()) as T);
|
128
|
-
}
|
129
|
-
} catch (err) {
|
130
|
-
reject(err);
|
131
|
-
}
|
132
|
-
});
|
133
|
-
}
|
134
|
-
}
|
package/lib/rest/index.ts
DELETED