disgroove 3.0.0 → 3.0.1-dev.6e60c8d
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 +38 -8
- package/dist/lib/Client.d.ts +15 -1
- package/dist/lib/Client.js +25 -0
- package/dist/lib/constants.d.ts +13 -1
- package/dist/lib/constants.js +14 -1
- package/dist/lib/gateway/Dispatcher.js +1 -0
- package/dist/lib/rest/Endpoints.d.ts +2 -0
- package/dist/lib/rest/Endpoints.js +6 -1
- package/dist/lib/rest/RequestManager.js +4 -0
- package/dist/lib/transformers/Components.d.ts +7 -1
- package/dist/lib/transformers/Components.js +72 -0
- package/dist/lib/transformers/Guilds.d.ts +2 -0
- package/dist/lib/transformers/Guilds.js +134 -0
- package/dist/lib/transformers/Interactions.js +46 -0
- package/dist/lib/transformers/Invites.d.ts +3 -0
- package/dist/lib/transformers/Invites.js +34 -2
- package/dist/lib/types/components.d.ts +124 -4
- package/dist/lib/types/gateway-events.d.ts +2 -0
- package/dist/lib/types/invite.d.ts +5 -2
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,42 @@
|
|
|
1
1
|
# disgroove
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
> A lightweight (≈ **791 KB** unpacked) and low-level Node.js dependency for interfacing with Discord, focused on accuracy and flexibility.
|
|
4
|
+
> It is designed for developers who want full control over the Discord API without heavy abstractions and want as little RAM and CPU usage as possible.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
- Lightweight
|
|
7
|
-
- Flexible
|
|
8
|
-
- 100% coverage of the [Official Discord API Documentation](https://discord.com/developers/docs/intro)
|
|
6
|
+
> **disgroove** is intended for developers already familiar with the Discord API and gateway model.
|
|
9
7
|
|
|
10
|
-
##
|
|
8
|
+
## Why disgroove?
|
|
9
|
+
|
|
10
|
+
### ✅ Accurate with the official Discord API
|
|
11
|
+
|
|
12
|
+
All commits (since __July 3, 2024__), types, REST requests, and utilities strictly follow the [official Discord API documentation repository](https://github.com/discord/discord-api-docs) and are referenced to the [Discord API developer docs](https://docs.discord.com/developers/intro).
|
|
13
|
+
|
|
14
|
+
Development releases are mainly published when breaking changes are introduced in the Discord API.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
### 🧠 Minimal caching
|
|
19
|
+
|
|
20
|
+
**disgroove** only caches guilds.
|
|
21
|
+
|
|
22
|
+
Guilds are mapped from the `READY` gateway event and kept in sync through
|
|
23
|
+
`GUILD_CREATE`, `GUILD_UPDATE` and `GUILD_DELETE` gateway events.
|
|
24
|
+
|
|
25
|
+
This design significantly decreases RAM and CPU usage and keeps the library lightweight.
|
|
11
26
|
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
### 🔧 Highly flexible and low-level
|
|
30
|
+
|
|
31
|
+
**disgroove** doesn't hide Discord features behind abstractions.
|
|
32
|
+
|
|
33
|
+
Every REST request is built directly on top of the [Discord API developer docs](https://docs.discord.com/developers/intro), with no changes.
|
|
34
|
+
|
|
35
|
+
You can listen to any gateway event directly using `Shard.ws.on(...)` and perform raw REST requests using `Client.rest.request(...)`
|
|
36
|
+
|
|
37
|
+
This allows you to use new Discord features immediately, even before a dedicated **disgroove** update is released.
|
|
38
|
+
|
|
39
|
+
## Example
|
|
12
40
|
```js
|
|
13
41
|
const {
|
|
14
42
|
Client,
|
|
@@ -17,7 +45,7 @@ const {
|
|
|
17
45
|
InteractionCallbackType,
|
|
18
46
|
MessageFlags,
|
|
19
47
|
} = require("disgroove");
|
|
20
|
-
const client = new Client(
|
|
48
|
+
const client = new Client(process.env.TOKEN);
|
|
21
49
|
|
|
22
50
|
client.once("ready", () => {
|
|
23
51
|
console.log("Logged in as", client.user.username);
|
|
@@ -28,7 +56,7 @@ client.once("ready", () => {
|
|
|
28
56
|
});
|
|
29
57
|
});
|
|
30
58
|
|
|
31
|
-
client.on("interactionCreate",
|
|
59
|
+
client.on("interactionCreate", (interaction) => {
|
|
32
60
|
if (interaction.type !== InteractionType.ApplicationCommand) return;
|
|
33
61
|
|
|
34
62
|
if (interaction.data.name === "ping") {
|
|
@@ -46,3 +74,5 @@ client.connect();
|
|
|
46
74
|
```
|
|
47
75
|
|
|
48
76
|
More examples on the [GitHub repository](https://github.com/sergiogotuzzo/disgroove/tree/main/examples)
|
|
77
|
+
|
|
78
|
+
> Enjoy **disgroove**? Leave a ⭐ to this repository!
|
package/dist/lib/Client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GatewayIntents, type OAuth2Scopes, type ActionTypes, type ImageWidgetStyleOptions, type ReactionTypes, type ApplicationCommandTypes, type EventTypes, type TriggerTypes, type ChannelTypes, type VideoQualityModes, type SortOrderTypes, type ForumLayoutTypes, type InviteTargetTypes, type VerificationLevel, type DefaultMessageNotificationLevel, type ExplicitContentFilterLevel, type SystemChannelFlags, type ApplicationFlags, type ApplicationIntegrationTypes, type ChannelFlags, type GuildFeatures, type GuildScheduledEventEntityTypes, type GuildScheduledEventPrivacyLevel, type GuildScheduledEventStatus, type MessageFlags, type OnboardingMode, type PrivacyLevel, type GuildMemberFlags, type InteractionContextTypes, type LobbyMemberFlags } from "./constants";
|
|
1
|
+
import { GatewayIntents, type OAuth2Scopes, type ActionTypes, type ImageWidgetStyleOptions, type ReactionTypes, type ApplicationCommandTypes, type EventTypes, type TriggerTypes, type ChannelTypes, type VideoQualityModes, type SortOrderTypes, type ForumLayoutTypes, type InviteTargetTypes, type VerificationLevel, type DefaultMessageNotificationLevel, type ExplicitContentFilterLevel, type SystemChannelFlags, type ApplicationFlags, type ApplicationIntegrationTypes, type ChannelFlags, type GuildFeatures, type GuildScheduledEventEntityTypes, type GuildScheduledEventPrivacyLevel, type GuildScheduledEventStatus, type MessageFlags, type OnboardingMode, type PrivacyLevel, type GuildMemberFlags, type InteractionContextTypes, type LobbyMemberFlags, InviteTargetUsersJobStatusErrorCodes } from "./constants";
|
|
2
2
|
import { RequestManager, type FileData } from "./rest";
|
|
3
3
|
import EventEmitter from "node:events";
|
|
4
4
|
import { Shard } from "./gateway";
|
|
@@ -181,6 +181,8 @@ export declare class Client extends EventEmitter {
|
|
|
181
181
|
targetType?: InviteTargetTypes;
|
|
182
182
|
targetUserId?: snowflake;
|
|
183
183
|
targetApplicationId?: snowflake;
|
|
184
|
+
targetUsersFile?: FileData;
|
|
185
|
+
rolesIds?: Array<snowflake>;
|
|
184
186
|
}, reason?: string): Promise<Invite>;
|
|
185
187
|
/** https://discord.com/developers/docs/resources/webhook#create-webhook */
|
|
186
188
|
createChannelWebhook(channelId: snowflake, options: {
|
|
@@ -950,6 +952,16 @@ export declare class Client extends EventEmitter {
|
|
|
950
952
|
withCounts?: boolean;
|
|
951
953
|
guildScheduledEventId?: snowflake;
|
|
952
954
|
}): Promise<Invite>;
|
|
955
|
+
/** https://discord.com/developers/docs/resources/invite#get-target-users */
|
|
956
|
+
getInviteTargetUser(inviteCode: string): Promise<Blob>;
|
|
957
|
+
getInviteTargetUserJobStatus(inviteCode: string): Promise<{
|
|
958
|
+
status: InviteTargetUsersJobStatusErrorCodes;
|
|
959
|
+
totalUsers: number;
|
|
960
|
+
processedUsers: number;
|
|
961
|
+
createdAt: timestamp;
|
|
962
|
+
completedAt: timestamp | null;
|
|
963
|
+
errorMessage: string | null;
|
|
964
|
+
}>;
|
|
953
965
|
/** https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads */
|
|
954
966
|
getJoinedPrivateArchivedThreads(channelId: snowflake, options?: {
|
|
955
967
|
before?: snowflake;
|
|
@@ -1100,6 +1112,8 @@ export declare class Client extends EventEmitter {
|
|
|
1100
1112
|
platformUsername?: string;
|
|
1101
1113
|
metadata?: ApplicationRoleConnectionMetadata;
|
|
1102
1114
|
}): Promise<ApplicationRoleConnection>;
|
|
1115
|
+
/** https://discord.com/developers/docs/resources/invite#update-target-users */
|
|
1116
|
+
updateInviteTargetUser(inviteCode: string, targetUsersFile: FileData): void;
|
|
1103
1117
|
/** https://discord.com/developers/docs/resources/channel#unpin-message */
|
|
1104
1118
|
unpinMessage(channelId: snowflake, messageId: snowflake, reason?: string): void;
|
|
1105
1119
|
}
|
package/dist/lib/Client.js
CHANGED
|
@@ -244,7 +244,11 @@ class Client extends node_events_1.default {
|
|
|
244
244
|
target_type: options.targetType,
|
|
245
245
|
target_user_id: options.targetUserId,
|
|
246
246
|
target_application_id: options.targetApplicationId,
|
|
247
|
+
roles_ids: options.rolesIds,
|
|
247
248
|
},
|
|
249
|
+
files: options.targetUsersFile !== undefined
|
|
250
|
+
? [options.targetUsersFile]
|
|
251
|
+
: undefined,
|
|
248
252
|
reason,
|
|
249
253
|
});
|
|
250
254
|
return transformers_1.Invites.inviteFromRaw(response);
|
|
@@ -2163,6 +2167,21 @@ class Client extends node_events_1.default {
|
|
|
2163
2167
|
});
|
|
2164
2168
|
return transformers_1.Invites.inviteFromRaw(response);
|
|
2165
2169
|
}
|
|
2170
|
+
/** https://discord.com/developers/docs/resources/invite#get-target-users */
|
|
2171
|
+
getInviteTargetUser(inviteCode) {
|
|
2172
|
+
return this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.inviteTargetUsers(inviteCode));
|
|
2173
|
+
}
|
|
2174
|
+
async getInviteTargetUserJobStatus(inviteCode) {
|
|
2175
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.inviteTargetUsersJobStatus(inviteCode));
|
|
2176
|
+
return {
|
|
2177
|
+
status: response.status,
|
|
2178
|
+
totalUsers: response.total_users,
|
|
2179
|
+
processedUsers: response.processed_users,
|
|
2180
|
+
createdAt: response.created_at,
|
|
2181
|
+
completedAt: response.completed_at,
|
|
2182
|
+
errorMessage: response.error_message,
|
|
2183
|
+
};
|
|
2184
|
+
}
|
|
2166
2185
|
/** https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads */
|
|
2167
2186
|
async getJoinedPrivateArchivedThreads(channelId, options) {
|
|
2168
2187
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelThreads(channelId, "private", true), {
|
|
@@ -2504,6 +2523,12 @@ class Client extends node_events_1.default {
|
|
|
2504
2523
|
metadata: transformers_1.ApplicationRoleConnectionMetadatas.applicationRoleConnectionMetadataFromRaw(response.metadata),
|
|
2505
2524
|
};
|
|
2506
2525
|
}
|
|
2526
|
+
/** https://discord.com/developers/docs/resources/invite#update-target-users */
|
|
2527
|
+
updateInviteTargetUser(inviteCode, targetUsersFile) {
|
|
2528
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.inviteTargetUsers(inviteCode), {
|
|
2529
|
+
files: [targetUsersFile],
|
|
2530
|
+
});
|
|
2531
|
+
}
|
|
2507
2532
|
/** https://discord.com/developers/docs/resources/channel#unpin-message */
|
|
2508
2533
|
unpinMessage(channelId, messageId, reason) {
|
|
2509
2534
|
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelPin(channelId, messageId), {
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -138,7 +138,10 @@ export declare enum ComponentTypes {
|
|
|
138
138
|
Separator = 14,
|
|
139
139
|
Container = 17,
|
|
140
140
|
Label = 18,
|
|
141
|
-
FileUpload = 19
|
|
141
|
+
FileUpload = 19,
|
|
142
|
+
RadioGroup = 21,
|
|
143
|
+
CheckboxGroup = 22,
|
|
144
|
+
Checkbox = 23
|
|
142
145
|
}
|
|
143
146
|
/** https://discord.com/developers/docs/components/reference#button-button-styles */
|
|
144
147
|
export declare enum ButtonStyles {
|
|
@@ -522,6 +525,13 @@ export declare enum InviteTargetTypes {
|
|
|
522
525
|
export declare enum GuildInviteFlags {
|
|
523
526
|
IsGuestInvite = 1
|
|
524
527
|
}
|
|
528
|
+
/** https://discord.com/developers/docs/resources/invite#get-target-users-job-status-error-codes */
|
|
529
|
+
export declare enum InviteTargetUsersJobStatusErrorCodes {
|
|
530
|
+
Unspecified = 0,
|
|
531
|
+
Processing = 1,
|
|
532
|
+
Completed = 2,
|
|
533
|
+
Failed = 3
|
|
534
|
+
}
|
|
525
535
|
/** https://discord.com/developers/docs/resources/lobby#lobby-member-object-lobby-member-flags */
|
|
526
536
|
export declare enum LobbyMemberFlags {
|
|
527
537
|
CanLinkLobby = 1
|
|
@@ -1012,6 +1022,8 @@ export declare enum JSONErrorCodes {
|
|
|
1012
1022
|
UnknownGuildScheduledEventUser = 10071,
|
|
1013
1023
|
UnknownTag = 10087,
|
|
1014
1024
|
UnknownSound = 10091,
|
|
1025
|
+
UnknownInviteTargetUsersJob = 10124,
|
|
1026
|
+
UnknownInviteTargetUsers = 10129,
|
|
1015
1027
|
BotsCannotUseThisEndpoint = 20001,
|
|
1016
1028
|
OnlyBotsCanUseThisEndpoint = 20002,
|
|
1017
1029
|
ExplicitContentCannotBeSentToTheDesiredRecipient = 20009,
|
package/dist/lib/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GuildScheduledEventRecurrenceRuleMonth = exports.GuildScheduledEventRecurrenceRuleWeekday = exports.GuildScheduledEventRecurrenceRuleFrequency = exports.GuildScheduledEventStatus = exports.GuildScheduledEventEntityTypes = exports.GuildScheduledEventPrivacyLevel = exports.ImageWidgetStyleOptions = exports.PromptTypes = exports.OnboardingMode = exports.IntegrationExpireBehaviors = exports.GuildMemberFlags = exports.MutableGuildFeatures = exports.GuildFeatures = exports.SystemChannelFlags = exports.PremiumTier = exports.GuildNSFWLevel = exports.VerificationLevel = exports.MFALevel = exports.ExplicitContentFilterLevel = exports.DefaultMessageNotificationLevel = exports.ForumLayoutTypes = exports.SortOrderTypes = exports.ChannelFlags = exports.VideoQualityModes = exports.ChannelTypes = exports.ActionTypes = exports.EventTypes = exports.KeywordPresetTypes = exports.TriggerTypes = exports.AuditLogEvents = exports.ApplicationRoleConnectionMetadataType = exports.ActivityLocationKind = exports.ApplicationFlags = exports.ApplicationEventWebhookStatus = exports.ApplicationIntegrationTypes = exports.SeparatorSpacing = exports.TextInputStyles = exports.ButtonStyles = exports.ComponentTypes = exports.InteractionCallbackType = exports.InteractionContextTypes = exports.InteractionType = exports.ApplicationCommandPermissionType = exports.EntryPointCommandHandlerTypes = exports.ApplicationCommandOptionType = exports.ApplicationCommandTypes = exports.Locales = exports.ImageFormats = exports.GuildNavigationTypes = exports.TimestampStyles = void 0;
|
|
4
|
-
exports.EntitlementTypes = exports.SKUFlags = exports.SKUTypes = exports.MembershipState = exports.TeamMemberRoleTypes = exports.RoleFlags = exports.BitwisePermissionFlags = exports.RPCCloseEventCodes = exports.RPCErrorCodes = exports.JSONErrorCodes = exports.HTTPResponseCodes = exports.VoiceCloseEventCodes = exports.VoiceOPCodes = exports.GatewayCloseEventCodes = exports.GatewayOPCodes = exports.OAuth2Scopes = exports.AnimationTypes = exports.ActivityFlags = exports.ActivityType = exports.GatewayEvents = exports.StatusTypes = exports.GatewayIntents = exports.DeviceType = exports.WebhookTypes = exports.SubscriptionStatuses = exports.VisibilityTypes = exports.Services = exports.PremiumTypes = exports.UserFlags = exports.StickerFormatTypes = exports.StickerTypes = exports.PrivacyLevel = exports.LayoutType = exports.ReactionTypes = exports.AllowedMentionTypes = exports.AttachmentFlags = exports.EmbedTypes = exports.MessageReferenceTypes = exports.MessageFlags = exports.MessageActivityTypes = exports.MessageTypes = exports.LobbyMemberFlags = exports.GuildInviteFlags = exports.InviteTargetTypes = exports.InviteTypes = void 0;
|
|
4
|
+
exports.EntitlementTypes = exports.SKUFlags = exports.SKUTypes = exports.MembershipState = exports.TeamMemberRoleTypes = exports.RoleFlags = exports.BitwisePermissionFlags = exports.RPCCloseEventCodes = exports.RPCErrorCodes = exports.JSONErrorCodes = exports.HTTPResponseCodes = exports.VoiceCloseEventCodes = exports.VoiceOPCodes = exports.GatewayCloseEventCodes = exports.GatewayOPCodes = exports.OAuth2Scopes = exports.AnimationTypes = exports.ActivityFlags = exports.ActivityType = exports.GatewayEvents = exports.StatusTypes = exports.GatewayIntents = exports.DeviceType = exports.WebhookTypes = exports.SubscriptionStatuses = exports.VisibilityTypes = exports.Services = exports.PremiumTypes = exports.UserFlags = exports.StickerFormatTypes = exports.StickerTypes = exports.PrivacyLevel = exports.LayoutType = exports.ReactionTypes = exports.AllowedMentionTypes = exports.AttachmentFlags = exports.EmbedTypes = exports.MessageReferenceTypes = exports.MessageFlags = exports.MessageActivityTypes = exports.MessageTypes = exports.LobbyMemberFlags = exports.InviteTargetUsersJobStatusErrorCodes = exports.GuildInviteFlags = exports.InviteTargetTypes = exports.InviteTypes = void 0;
|
|
5
5
|
/** https://discord.com/developers/docs/reference#message-formatting-timestamp-styles */
|
|
6
6
|
var TimestampStyles;
|
|
7
7
|
(function (TimestampStyles) {
|
|
@@ -155,6 +155,9 @@ var ComponentTypes;
|
|
|
155
155
|
ComponentTypes[ComponentTypes["Container"] = 17] = "Container";
|
|
156
156
|
ComponentTypes[ComponentTypes["Label"] = 18] = "Label";
|
|
157
157
|
ComponentTypes[ComponentTypes["FileUpload"] = 19] = "FileUpload";
|
|
158
|
+
ComponentTypes[ComponentTypes["RadioGroup"] = 21] = "RadioGroup";
|
|
159
|
+
ComponentTypes[ComponentTypes["CheckboxGroup"] = 22] = "CheckboxGroup";
|
|
160
|
+
ComponentTypes[ComponentTypes["Checkbox"] = 23] = "Checkbox";
|
|
158
161
|
})(ComponentTypes || (exports.ComponentTypes = ComponentTypes = {}));
|
|
159
162
|
/** https://discord.com/developers/docs/components/reference#button-button-styles */
|
|
160
163
|
var ButtonStyles;
|
|
@@ -579,6 +582,14 @@ var GuildInviteFlags;
|
|
|
579
582
|
(function (GuildInviteFlags) {
|
|
580
583
|
GuildInviteFlags[GuildInviteFlags["IsGuestInvite"] = 1] = "IsGuestInvite";
|
|
581
584
|
})(GuildInviteFlags || (exports.GuildInviteFlags = GuildInviteFlags = {}));
|
|
585
|
+
/** https://discord.com/developers/docs/resources/invite#get-target-users-job-status-error-codes */
|
|
586
|
+
var InviteTargetUsersJobStatusErrorCodes;
|
|
587
|
+
(function (InviteTargetUsersJobStatusErrorCodes) {
|
|
588
|
+
InviteTargetUsersJobStatusErrorCodes[InviteTargetUsersJobStatusErrorCodes["Unspecified"] = 0] = "Unspecified";
|
|
589
|
+
InviteTargetUsersJobStatusErrorCodes[InviteTargetUsersJobStatusErrorCodes["Processing"] = 1] = "Processing";
|
|
590
|
+
InviteTargetUsersJobStatusErrorCodes[InviteTargetUsersJobStatusErrorCodes["Completed"] = 2] = "Completed";
|
|
591
|
+
InviteTargetUsersJobStatusErrorCodes[InviteTargetUsersJobStatusErrorCodes["Failed"] = 3] = "Failed";
|
|
592
|
+
})(InviteTargetUsersJobStatusErrorCodes || (exports.InviteTargetUsersJobStatusErrorCodes = InviteTargetUsersJobStatusErrorCodes = {}));
|
|
582
593
|
/** https://discord.com/developers/docs/resources/lobby#lobby-member-object-lobby-member-flags */
|
|
583
594
|
var LobbyMemberFlags;
|
|
584
595
|
(function (LobbyMemberFlags) {
|
|
@@ -1102,6 +1113,8 @@ var JSONErrorCodes;
|
|
|
1102
1113
|
JSONErrorCodes[JSONErrorCodes["UnknownGuildScheduledEventUser"] = 10071] = "UnknownGuildScheduledEventUser";
|
|
1103
1114
|
JSONErrorCodes[JSONErrorCodes["UnknownTag"] = 10087] = "UnknownTag";
|
|
1104
1115
|
JSONErrorCodes[JSONErrorCodes["UnknownSound"] = 10091] = "UnknownSound";
|
|
1116
|
+
JSONErrorCodes[JSONErrorCodes["UnknownInviteTargetUsersJob"] = 10124] = "UnknownInviteTargetUsersJob";
|
|
1117
|
+
JSONErrorCodes[JSONErrorCodes["UnknownInviteTargetUsers"] = 10129] = "UnknownInviteTargetUsers";
|
|
1105
1118
|
JSONErrorCodes[JSONErrorCodes["BotsCannotUseThisEndpoint"] = 20001] = "BotsCannotUseThisEndpoint";
|
|
1106
1119
|
JSONErrorCodes[JSONErrorCodes["OnlyBotsCanUseThisEndpoint"] = 20002] = "OnlyBotsCanUseThisEndpoint";
|
|
1107
1120
|
JSONErrorCodes[JSONErrorCodes["ExplicitContentCannotBeSentToTheDesiredRecipient"] = 20009] = "ExplicitContentCannotBeSentToTheDesiredRecipient";
|
|
@@ -113,3 +113,5 @@ export declare const lobbies: () => "lobbies";
|
|
|
113
113
|
export declare const lobby: (lobbyId: snowflake) => `lobbies/${string}`;
|
|
114
114
|
export declare const lobbyMember: (lobbyId: snowflake, userId?: snowflake | "@me") => `lobbies/${string}/members/${string}`;
|
|
115
115
|
export declare const lobbyChannelLinking: (lobbyId: snowflake) => `lobbies/${string}/channel-linking`;
|
|
116
|
+
export declare const inviteTargetUsers: (inviteCode: string) => `invites/${string}/target-users`;
|
|
117
|
+
export declare const inviteTargetUsersJobStatus: (inviteCode: string) => `invites/${string}/target-users/job-status`;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.channelFollowers = exports.channelBulkDelete = exports.channel = exports.template = exports.guildWidgetSettings = exports.guildWidgetJSON = exports.guildWidgetImage = exports.guildWelcomeScreen = exports.guildWebhooks = exports.guildVoiceState = exports.guildVoiceRegions = exports.guildVanityURL = exports.guildTemplates = exports.guildTemplate = exports.guildStickers = exports.guildSticker = exports.guildSoundboardSounds = exports.guildSoundboardSound = exports.guildScheduledEventUsers = exports.guildScheduledEvents = exports.guildScheduledEvent = exports.guildRoles = exports.guildRoleMemberCounts = exports.guildRole = exports.guildPrune = exports.guildPreview = exports.guildOnboarding = exports.guildMemberVerification = exports.guildMembersSearch = exports.guildMembers = exports.guildMemberRole = exports.guildMember = exports.guildMFA = exports.guildInvites = exports.guildIntegrations = exports.guildIntegration = exports.guildIncidentsActions = exports.guildEmojis = exports.guildEmoji = exports.guildMemberNickname = exports.guildChannels = exports.guildBulkBan = exports.guildBans = exports.guildBan = exports.guildAutoModerationRules = exports.guildAutoModerationRule = exports.guildAuditLog = exports.guildActiveThreads = exports.guilds = exports.guild = void 0;
|
|
4
4
|
exports.oauth2Authorize = exports.gatewayBot = exports.gateway = exports.soundboardDefaultSounds = exports.sendSoundboardSound = exports.skuSubscriptions = exports.skuSubscription = exports.stickerPacks = exports.stickerPack = exports.webhookPlatform = exports.webhookMessage = exports.webhook = exports.guildApplicationCommandsPermissions = exports.applicationSKUs = exports.applicationRoleConnectionMetadata = exports.applicationGuildCommands = exports.applicationGuildCommand = exports.applicationEntitlements = exports.applicationEntitlementConsume = exports.applicationEntitlement = exports.applicationEmojis = exports.applicationEmoji = exports.applicationUser = exports.applicationCommandPermissions = exports.applicationCommands = exports.applicationCommand = exports.applicationActivityInstance = exports.userGuilds = exports.userGuild = exports.userConnections = exports.userChannels = exports.userApplicationRoleConnection = exports.user = exports.pollExpire = exports.pollAnswerVoters = exports.threadMembers = exports.threads = exports.channelWebhooks = exports.channelTyping = exports.channelThreads = exports.channelRecipient = exports.channelPins = exports.channelPin = exports.channelPermission = exports.channelMessages = exports.channelMessageReaction = exports.channelMessageCrosspost = exports.channelMessageAllReactions = exports.channelMessage = exports.channelInvites = void 0;
|
|
5
|
-
exports.lobbyChannelLinking = exports.lobbyMember = exports.lobby = exports.lobbies = exports.voiceRegions = exports.sticker = exports.stageInstances = exports.stageInstance = exports.invite = exports.interactionCallback = exports.oauth2TokenRevocation = exports.oauth2TokenExchange = exports.oauth2Authorization = exports.oauth2Application = void 0;
|
|
5
|
+
exports.inviteTargetUsersJobStatus = exports.inviteTargetUsers = exports.lobbyChannelLinking = exports.lobbyMember = exports.lobby = exports.lobbies = exports.voiceRegions = exports.sticker = exports.stageInstances = exports.stageInstance = exports.invite = exports.interactionCallback = exports.oauth2TokenRevocation = exports.oauth2TokenExchange = exports.oauth2Authorization = exports.oauth2Application = void 0;
|
|
6
6
|
// Guilds
|
|
7
7
|
const guild = (guildId) => `guilds/${guildId}`;
|
|
8
8
|
exports.guild = guild;
|
|
@@ -253,3 +253,8 @@ const lobbyMember = (lobbyId, userId = "@me") => `lobbies/${lobbyId}/members/${u
|
|
|
253
253
|
exports.lobbyMember = lobbyMember;
|
|
254
254
|
const lobbyChannelLinking = (lobbyId) => `lobbies/${lobbyId}/channel-linking`;
|
|
255
255
|
exports.lobbyChannelLinking = lobbyChannelLinking;
|
|
256
|
+
// Invites
|
|
257
|
+
const inviteTargetUsers = (inviteCode) => `invites/${inviteCode}/target-users`;
|
|
258
|
+
exports.inviteTargetUsers = inviteTargetUsers;
|
|
259
|
+
const inviteTargetUsersJobStatus = (inviteCode) => `invites/${inviteCode}/target-users/job-status`;
|
|
260
|
+
exports.inviteTargetUsersJobStatus = inviteTargetUsersJobStatus;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionRow, Button, Container, RawActionRow, RawButton, RawContainer, RawFile, File, RawUnfurledMediaItem, UnfurledMediaItem, RawTextDisplay, TextDisplay, RawSeparator, Separator, RawSection, Section, Thumbnail, RawThumbnail, TextInput, RawTextInput, MediaGallery, RawMediaGallery, RawStringSelect, StringSelect, RawUserSelect, UserSelect, RawRoleSelect, RoleSelect, RawMentionableSelect, MentionableSelect, RawChannelSelect, ChannelSelect, RawLabel, Label, RawFileUpload, FileUpload } from "../types/components";
|
|
1
|
+
import { ActionRow, Button, Container, RawActionRow, RawButton, RawContainer, RawFile, File, RawUnfurledMediaItem, UnfurledMediaItem, RawTextDisplay, TextDisplay, RawSeparator, Separator, RawSection, Section, Thumbnail, RawThumbnail, TextInput, RawTextInput, MediaGallery, RawMediaGallery, RawStringSelect, StringSelect, RawUserSelect, UserSelect, RawRoleSelect, RoleSelect, RawMentionableSelect, MentionableSelect, RawChannelSelect, ChannelSelect, RawLabel, Label, RawFileUpload, FileUpload, RawRadioGroup, RadioGroup, RawCheckbox, Checkbox, RawCheckboxGroup, CheckboxGroup } from "../types/components";
|
|
2
2
|
export declare class Components {
|
|
3
3
|
static actionRowFromRaw(actionRow: RawActionRow): ActionRow;
|
|
4
4
|
static actionRowToRaw(actionRow: ActionRow): RawActionRow;
|
|
@@ -6,6 +6,10 @@ export declare class Components {
|
|
|
6
6
|
static buttonToRaw(button: Button): RawButton;
|
|
7
7
|
static channelSelectFromRaw(channelSelect: RawChannelSelect): ChannelSelect;
|
|
8
8
|
static channelSelectToRaw(channelSelect: ChannelSelect): RawChannelSelect;
|
|
9
|
+
static checkboxFromRaw(checkbox: RawCheckbox): Checkbox;
|
|
10
|
+
static checkboxToRaw(checkbox: Checkbox): RawCheckbox;
|
|
11
|
+
static checkboxGroupFromRaw(checkboxGroup: RawCheckboxGroup): CheckboxGroup;
|
|
12
|
+
static checkboxGroupToRaw(checkboxGroup: CheckboxGroup): RawCheckboxGroup;
|
|
9
13
|
static containerFromRaw(container: RawContainer): Container;
|
|
10
14
|
static containerToRaw(container: Container): RawContainer;
|
|
11
15
|
static fileFromRaw(file: RawFile): File;
|
|
@@ -18,6 +22,8 @@ export declare class Components {
|
|
|
18
22
|
static mediaGalleryToRaw(mediaGallery: MediaGallery): RawMediaGallery;
|
|
19
23
|
static mentionableSelectFromRaw(mentionableSelect: RawMentionableSelect): MentionableSelect;
|
|
20
24
|
static mentionableSelectToRaw(mentionableSelect: MentionableSelect): RawMentionableSelect;
|
|
25
|
+
static radioGroupFromRaw(radioGroup: RawRadioGroup): RadioGroup;
|
|
26
|
+
static radioGroupToRaw(radioGroup: RadioGroup): RawRadioGroup;
|
|
21
27
|
static roleSelectFromRaw(roleSelect: RawRoleSelect): RoleSelect;
|
|
22
28
|
static roleSelectToRaw(roleSelect: RoleSelect): RawRoleSelect;
|
|
23
29
|
static sectionFromRaw(section: RawSection): Section;
|
|
@@ -103,6 +103,44 @@ class Components {
|
|
|
103
103
|
disabled: channelSelect.disabled,
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
+
static checkboxFromRaw(checkbox) {
|
|
107
|
+
return {
|
|
108
|
+
type: checkbox.type,
|
|
109
|
+
id: checkbox.id,
|
|
110
|
+
customId: checkbox.custom_id,
|
|
111
|
+
default: checkbox.default,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
static checkboxToRaw(checkbox) {
|
|
115
|
+
return {
|
|
116
|
+
type: checkbox.type,
|
|
117
|
+
id: checkbox.id,
|
|
118
|
+
custom_id: checkbox.customId,
|
|
119
|
+
default: checkbox.default,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
static checkboxGroupFromRaw(checkboxGroup) {
|
|
123
|
+
return {
|
|
124
|
+
type: checkboxGroup.type,
|
|
125
|
+
id: checkboxGroup.id,
|
|
126
|
+
customId: checkboxGroup.custom_id,
|
|
127
|
+
options: checkboxGroup.options,
|
|
128
|
+
minValues: checkboxGroup.min_values,
|
|
129
|
+
maxValues: checkboxGroup.max_values,
|
|
130
|
+
required: checkboxGroup.required,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
static checkboxGroupToRaw(checkboxGroup) {
|
|
134
|
+
return {
|
|
135
|
+
type: checkboxGroup.type,
|
|
136
|
+
id: checkboxGroup.id,
|
|
137
|
+
custom_id: checkboxGroup.customId,
|
|
138
|
+
options: checkboxGroup.options,
|
|
139
|
+
min_values: checkboxGroup.minValues,
|
|
140
|
+
max_values: checkboxGroup.maxValues,
|
|
141
|
+
required: checkboxGroup.required,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
106
144
|
static containerFromRaw(container) {
|
|
107
145
|
return {
|
|
108
146
|
type: container.type,
|
|
@@ -227,6 +265,14 @@ class Components {
|
|
|
227
265
|
case constants_1.ComponentTypes.FileUpload:
|
|
228
266
|
component = Components.fileUploadFromRaw(label.component);
|
|
229
267
|
break;
|
|
268
|
+
case constants_1.ComponentTypes.RadioGroup:
|
|
269
|
+
component = Components.radioGroupFromRaw(label.component);
|
|
270
|
+
break;
|
|
271
|
+
case constants_1.ComponentTypes.CheckboxGroup:
|
|
272
|
+
component = Components.checkboxGroupFromRaw(label.component);
|
|
273
|
+
break;
|
|
274
|
+
case constants_1.ComponentTypes.Checkbox:
|
|
275
|
+
component = Components.checkboxFromRaw(label.component);
|
|
230
276
|
}
|
|
231
277
|
return {
|
|
232
278
|
type: label.type,
|
|
@@ -260,6 +306,14 @@ class Components {
|
|
|
260
306
|
case constants_1.ComponentTypes.FileUpload:
|
|
261
307
|
component = Components.fileUploadToRaw(label.component);
|
|
262
308
|
break;
|
|
309
|
+
case constants_1.ComponentTypes.RadioGroup:
|
|
310
|
+
component = Components.radioGroupToRaw(label.component);
|
|
311
|
+
break;
|
|
312
|
+
case constants_1.ComponentTypes.CheckboxGroup:
|
|
313
|
+
component = Components.checkboxGroupToRaw(label.component);
|
|
314
|
+
break;
|
|
315
|
+
case constants_1.ComponentTypes.Checkbox:
|
|
316
|
+
component = Components.checkboxToRaw(label.component);
|
|
263
317
|
}
|
|
264
318
|
return {
|
|
265
319
|
type: label.type,
|
|
@@ -315,6 +369,24 @@ class Components {
|
|
|
315
369
|
disabled: mentionableSelect.disabled,
|
|
316
370
|
};
|
|
317
371
|
}
|
|
372
|
+
static radioGroupFromRaw(radioGroup) {
|
|
373
|
+
return {
|
|
374
|
+
type: radioGroup.type,
|
|
375
|
+
id: radioGroup.id,
|
|
376
|
+
customId: radioGroup.custom_id,
|
|
377
|
+
options: radioGroup.options,
|
|
378
|
+
required: radioGroup.required,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
static radioGroupToRaw(radioGroup) {
|
|
382
|
+
return {
|
|
383
|
+
type: radioGroup.type,
|
|
384
|
+
id: radioGroup.id,
|
|
385
|
+
custom_id: radioGroup.customId,
|
|
386
|
+
options: radioGroup.options,
|
|
387
|
+
required: radioGroup.required,
|
|
388
|
+
};
|
|
389
|
+
}
|
|
318
390
|
static roleSelectFromRaw(roleSelect) {
|
|
319
391
|
return {
|
|
320
392
|
type: roleSelect.type,
|
|
@@ -9,4 +9,6 @@ export declare class Guilds {
|
|
|
9
9
|
static guildToRaw(guild: Guild): RawGuild;
|
|
10
10
|
static integrationFromRaw(integration: RawIntegration): Integration;
|
|
11
11
|
static integrationToRaw(integration: Integration): RawIntegration;
|
|
12
|
+
static partialGuildFromRaw(guild: Partial<RawGuild>): Partial<Guild>;
|
|
13
|
+
static partialGuildToRaw(guild: Partial<Guild>): Partial<RawGuild>;
|
|
12
14
|
}
|
|
@@ -276,5 +276,139 @@ class Guilds {
|
|
|
276
276
|
scopes: integration.scopes,
|
|
277
277
|
};
|
|
278
278
|
}
|
|
279
|
+
static partialGuildFromRaw(guild) {
|
|
280
|
+
return {
|
|
281
|
+
id: guild.id,
|
|
282
|
+
name: guild.name,
|
|
283
|
+
icon: guild.icon,
|
|
284
|
+
iconHash: guild.icon,
|
|
285
|
+
splash: guild.splash,
|
|
286
|
+
discoverySplash: guild.discovery_splash,
|
|
287
|
+
owner: guild.owner,
|
|
288
|
+
ownerId: guild.owner_id,
|
|
289
|
+
permissions: guild.permissions,
|
|
290
|
+
region: guild.region,
|
|
291
|
+
afkChannelId: guild.afk_channel_id,
|
|
292
|
+
afkTimeout: guild.afk_timeout,
|
|
293
|
+
widgetEnabled: guild.widget_enabled,
|
|
294
|
+
widgetChannelId: guild.widget_channel_id,
|
|
295
|
+
verificationLevel: guild.verification_level,
|
|
296
|
+
defaultMessageNotifications: guild.default_message_notifications,
|
|
297
|
+
explicitContentFilter: guild.explicit_content_filter,
|
|
298
|
+
roles: guild.roles?.map((role) => Roles_1.Roles.roleFromRaw(role)),
|
|
299
|
+
emojis: guild.emojis?.map((emoji) => Emojis_1.Emojis.emojiFromRaw(emoji)),
|
|
300
|
+
features: guild.features,
|
|
301
|
+
mfaLevel: guild.mfa_level,
|
|
302
|
+
applicationId: guild.application_id,
|
|
303
|
+
systemChannelId: guild.system_channel_id,
|
|
304
|
+
systemChannelFlags: guild.system_channel_flags,
|
|
305
|
+
rulesChannelId: guild.rules_channel_id,
|
|
306
|
+
maxPresences: guild.max_presences,
|
|
307
|
+
maxMembers: guild.max_members,
|
|
308
|
+
vanityURLCode: guild.vanity_url_code,
|
|
309
|
+
description: guild.description,
|
|
310
|
+
banner: guild.banner,
|
|
311
|
+
premiumTier: guild.premium_tier,
|
|
312
|
+
premiumSubscriptionCount: guild.premium_subscription_count,
|
|
313
|
+
preferredLocale: guild.preferred_locale,
|
|
314
|
+
publicUpdatesChannelId: guild.public_updates_channel_id,
|
|
315
|
+
maxVideoChannelUsers: guild.max_video_channel_users,
|
|
316
|
+
maxStageVideoChannelUsers: guild.max_stage_video_channel_users,
|
|
317
|
+
approximateMemberCount: guild.approximate_member_count,
|
|
318
|
+
approximatePresenceCount: guild.approximate_presence_count,
|
|
319
|
+
welcomeScreen: guild.welcome_screen !== undefined
|
|
320
|
+
? {
|
|
321
|
+
description: guild.welcome_screen.description,
|
|
322
|
+
welcomeChannels: guild.welcome_screen.welcome_channels.map((welcomeScreenChannel) => ({
|
|
323
|
+
channelId: welcomeScreenChannel.channel_id,
|
|
324
|
+
description: welcomeScreenChannel.description,
|
|
325
|
+
emojiId: welcomeScreenChannel.emoji_id,
|
|
326
|
+
emojiName: welcomeScreenChannel.emoji_name,
|
|
327
|
+
})),
|
|
328
|
+
}
|
|
329
|
+
: undefined,
|
|
330
|
+
nsfwLevel: guild.nsfw_level,
|
|
331
|
+
stickers: guild.stickers?.map((sticker) => Stickers_1.Stickers.stickerFromRaw(sticker)),
|
|
332
|
+
premiumProgressBarEnabled: guild.premium_progress_bar_enabled,
|
|
333
|
+
safetyAlertsChannelId: guild.safety_alerts_channel_id,
|
|
334
|
+
incidentsData: guild.incidents_data !== undefined
|
|
335
|
+
? guild.incidents_data !== null
|
|
336
|
+
? {
|
|
337
|
+
invitesDisabledUntil: guild.incidents_data.invites_disabled_until,
|
|
338
|
+
dmsDisabledUntil: guild.incidents_data.dms_disabled_until,
|
|
339
|
+
dmSpamDetectedAt: guild.incidents_data.dm_spam_detected_at,
|
|
340
|
+
raidDetectedAt: guild.incidents_data.raid_detected_at,
|
|
341
|
+
}
|
|
342
|
+
: null
|
|
343
|
+
: undefined,
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
static partialGuildToRaw(guild) {
|
|
347
|
+
return {
|
|
348
|
+
id: guild.id,
|
|
349
|
+
name: guild.name,
|
|
350
|
+
icon: guild.icon,
|
|
351
|
+
icon_hash: guild.icon,
|
|
352
|
+
splash: guild.splash,
|
|
353
|
+
discovery_splash: guild.discoverySplash,
|
|
354
|
+
owner: guild.owner,
|
|
355
|
+
owner_id: guild.ownerId,
|
|
356
|
+
permissions: guild.permissions,
|
|
357
|
+
region: guild.region,
|
|
358
|
+
afk_channel_id: guild.afkChannelId,
|
|
359
|
+
afk_timeout: guild.afkTimeout,
|
|
360
|
+
widget_enabled: guild.widgetEnabled,
|
|
361
|
+
widget_channel_id: guild.widgetChannelId,
|
|
362
|
+
verification_level: guild.verificationLevel,
|
|
363
|
+
default_message_notifications: guild.defaultMessageNotifications,
|
|
364
|
+
explicit_content_filter: guild.explicitContentFilter,
|
|
365
|
+
roles: guild.roles?.map((role) => Roles_1.Roles.roleToRaw(role)),
|
|
366
|
+
emojis: guild.emojis?.map((emoji) => Emojis_1.Emojis.emojiToRaw(emoji)),
|
|
367
|
+
features: guild.features,
|
|
368
|
+
mfa_level: guild.mfaLevel,
|
|
369
|
+
application_id: guild.applicationId,
|
|
370
|
+
system_channel_id: guild.systemChannelId,
|
|
371
|
+
system_channel_flags: guild.systemChannelFlags,
|
|
372
|
+
rules_channel_id: guild.rulesChannelId,
|
|
373
|
+
max_presences: guild.maxPresences,
|
|
374
|
+
max_members: guild.maxMembers,
|
|
375
|
+
vanity_url_code: guild.vanityURLCode,
|
|
376
|
+
description: guild.description,
|
|
377
|
+
banner: guild.banner,
|
|
378
|
+
premium_tier: guild.premiumTier,
|
|
379
|
+
premium_subscription_count: guild.premiumSubscriptionCount,
|
|
380
|
+
preferred_locale: guild.preferredLocale,
|
|
381
|
+
public_updates_channel_id: guild.publicUpdatesChannelId,
|
|
382
|
+
max_video_channel_users: guild.maxVideoChannelUsers,
|
|
383
|
+
max_stage_video_channel_users: guild.maxStageVideoChannelUsers,
|
|
384
|
+
approximate_member_count: guild.approximateMemberCount,
|
|
385
|
+
approximate_presence_count: guild.approximatePresenceCount,
|
|
386
|
+
welcome_screen: guild.welcomeScreen !== undefined
|
|
387
|
+
? {
|
|
388
|
+
description: guild.welcomeScreen.description,
|
|
389
|
+
welcome_channels: guild.welcomeScreen.welcomeChannels.map((welcomeScreenChannel) => ({
|
|
390
|
+
channel_id: welcomeScreenChannel.channelId,
|
|
391
|
+
description: welcomeScreenChannel.description,
|
|
392
|
+
emoji_id: welcomeScreenChannel.emojiId,
|
|
393
|
+
emoji_name: welcomeScreenChannel.emojiName,
|
|
394
|
+
})),
|
|
395
|
+
}
|
|
396
|
+
: undefined,
|
|
397
|
+
nsfw_level: guild.nsfwLevel,
|
|
398
|
+
stickers: guild.stickers?.map((sticker) => Stickers_1.Stickers.stickerToRaw(sticker)),
|
|
399
|
+
premium_progress_bar_enabled: guild.premiumProgressBarEnabled,
|
|
400
|
+
safety_alerts_channel_id: guild.safetyAlertsChannelId,
|
|
401
|
+
incidents_data: guild.incidentsData !== undefined
|
|
402
|
+
? guild.incidentsData !== null
|
|
403
|
+
? {
|
|
404
|
+
invites_disabled_until: guild.incidentsData.invitesDisabledUntil,
|
|
405
|
+
dms_disabled_until: guild.incidentsData.dmsDisabledUntil,
|
|
406
|
+
dm_spam_detected_at: guild.incidentsData.dmSpamDetectedAt,
|
|
407
|
+
raid_detected_at: guild.incidentsData.raidDetectedAt,
|
|
408
|
+
}
|
|
409
|
+
: null
|
|
410
|
+
: undefined,
|
|
411
|
+
};
|
|
412
|
+
}
|
|
279
413
|
}
|
|
280
414
|
exports.Guilds = Guilds;
|
|
@@ -211,6 +211,29 @@ class Interactions {
|
|
|
211
211
|
values: component.component.values,
|
|
212
212
|
};
|
|
213
213
|
break;
|
|
214
|
+
case constants_1.ComponentTypes.RadioGroup:
|
|
215
|
+
c = {
|
|
216
|
+
type: component.component.type,
|
|
217
|
+
id: component.component.id,
|
|
218
|
+
customId: component.component.custom_id,
|
|
219
|
+
value: component.component.value
|
|
220
|
+
};
|
|
221
|
+
break;
|
|
222
|
+
case constants_1.ComponentTypes.CheckboxGroup:
|
|
223
|
+
c = {
|
|
224
|
+
type: component.component.type,
|
|
225
|
+
id: component.component.id,
|
|
226
|
+
customId: component.component.custom_id,
|
|
227
|
+
values: component.component.values,
|
|
228
|
+
};
|
|
229
|
+
break;
|
|
230
|
+
case constants_1.ComponentTypes.Checkbox:
|
|
231
|
+
c = {
|
|
232
|
+
type: component.component.type,
|
|
233
|
+
id: component.component.id,
|
|
234
|
+
customId: component.component.custom_id,
|
|
235
|
+
value: component.component.value
|
|
236
|
+
};
|
|
214
237
|
}
|
|
215
238
|
return {
|
|
216
239
|
type: component.type,
|
|
@@ -449,6 +472,29 @@ class Interactions {
|
|
|
449
472
|
values: component.component.values,
|
|
450
473
|
};
|
|
451
474
|
break;
|
|
475
|
+
case constants_1.ComponentTypes.RadioGroup:
|
|
476
|
+
c = {
|
|
477
|
+
type: component.component.type,
|
|
478
|
+
id: component.component.id,
|
|
479
|
+
custom_id: component.component.customId,
|
|
480
|
+
value: component.component.value
|
|
481
|
+
};
|
|
482
|
+
break;
|
|
483
|
+
case constants_1.ComponentTypes.CheckboxGroup:
|
|
484
|
+
c = {
|
|
485
|
+
type: component.component.type,
|
|
486
|
+
id: component.component.id,
|
|
487
|
+
custom_id: component.component.customId,
|
|
488
|
+
values: component.component.values,
|
|
489
|
+
};
|
|
490
|
+
break;
|
|
491
|
+
case constants_1.ComponentTypes.Checkbox:
|
|
492
|
+
c = {
|
|
493
|
+
type: component.component.type,
|
|
494
|
+
id: component.component.id,
|
|
495
|
+
custom_id: component.component.customId,
|
|
496
|
+
value: component.component.value
|
|
497
|
+
};
|
|
452
498
|
}
|
|
453
499
|
return {
|
|
454
500
|
type: component.type,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { RawInvite, Invite } from "../types/invite";
|
|
2
|
+
import { RawRole, Role } from "../types/role";
|
|
2
3
|
export declare class Invites {
|
|
3
4
|
static inviteFromRaw(invite: RawInvite): Invite;
|
|
4
5
|
static inviteToRaw(invite: Invite): RawInvite;
|
|
6
|
+
static partialRoleFromRaw(role: Pick<RawRole, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicode_emoji">): Pick<Role, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicodeEmoji">;
|
|
7
|
+
static partialRoleToRaw(role: Pick<Role, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicodeEmoji">): Pick<RawRole, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicode_emoji">;
|
|
5
8
|
}
|
|
@@ -12,7 +12,7 @@ class Invites {
|
|
|
12
12
|
type: invite.type,
|
|
13
13
|
code: invite.code,
|
|
14
14
|
guild: invite.guild !== undefined
|
|
15
|
-
? Guilds_1.Guilds.
|
|
15
|
+
? Guilds_1.Guilds.partialGuildFromRaw(invite.guild)
|
|
16
16
|
: undefined,
|
|
17
17
|
channel: Channels_1.Channels.channelFromRaw(invite.channel),
|
|
18
18
|
inviter: invite.inviter !== undefined
|
|
@@ -40,6 +40,7 @@ class Invites {
|
|
|
40
40
|
? GuildScheduledEvents_1.GuildScheduledEvents.guildScheduledEventFromRaw(invite.guild_scheduled_event)
|
|
41
41
|
: undefined,
|
|
42
42
|
flags: invite.flags,
|
|
43
|
+
roles: invite.roles?.map((role) => Invites.partialRoleFromRaw(role))
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
static inviteToRaw(invite) {
|
|
@@ -47,7 +48,7 @@ class Invites {
|
|
|
47
48
|
type: invite.type,
|
|
48
49
|
code: invite.code,
|
|
49
50
|
guild: invite.guild !== undefined
|
|
50
|
-
? Guilds_1.Guilds.
|
|
51
|
+
? Guilds_1.Guilds.partialGuildToRaw(invite.guild)
|
|
51
52
|
: undefined,
|
|
52
53
|
channel: Channels_1.Channels.channelToRaw(invite.channel),
|
|
53
54
|
inviter: invite.inviter !== undefined
|
|
@@ -75,6 +76,37 @@ class Invites {
|
|
|
75
76
|
? GuildScheduledEvents_1.GuildScheduledEvents.guildScheduledEventToRaw(invite.guildScheduledEvent)
|
|
76
77
|
: undefined,
|
|
77
78
|
flags: invite.flags,
|
|
79
|
+
roles: invite.roles?.map((role) => Invites.partialRoleToRaw(role))
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
static partialRoleFromRaw(role) {
|
|
83
|
+
return {
|
|
84
|
+
id: role.id,
|
|
85
|
+
name: role.name,
|
|
86
|
+
position: role.position,
|
|
87
|
+
color: role.color,
|
|
88
|
+
colors: {
|
|
89
|
+
primaryColor: role.colors.primary_color,
|
|
90
|
+
secondaryColor: role.colors.secondary_color,
|
|
91
|
+
tertiaryColor: role.colors.tertiary_color
|
|
92
|
+
},
|
|
93
|
+
icon: role.icon,
|
|
94
|
+
unicodeEmoji: role.unicode_emoji
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
static partialRoleToRaw(role) {
|
|
98
|
+
return {
|
|
99
|
+
id: role.id,
|
|
100
|
+
name: role.name,
|
|
101
|
+
position: role.position,
|
|
102
|
+
color: role.color,
|
|
103
|
+
colors: {
|
|
104
|
+
primary_color: role.colors.primaryColor,
|
|
105
|
+
secondary_color: role.colors.secondaryColor,
|
|
106
|
+
tertiary_color: role.colors.tertiaryColor
|
|
107
|
+
},
|
|
108
|
+
icon: role.icon,
|
|
109
|
+
unicode_emoji: role.unicodeEmoji
|
|
78
110
|
};
|
|
79
111
|
}
|
|
80
112
|
}
|
|
@@ -222,13 +222,13 @@ export interface RawLabel {
|
|
|
222
222
|
id?: number;
|
|
223
223
|
label: string;
|
|
224
224
|
description?: string;
|
|
225
|
-
component: RawTextInput | RawStringSelect | RawUserSelect | RawRoleSelect | RawMentionableSelect | RawChannelSelect | RawFileUpload;
|
|
225
|
+
component: RawTextInput | RawStringSelect | RawUserSelect | RawRoleSelect | RawMentionableSelect | RawChannelSelect | RawFileUpload | RawRadioGroup | RawCheckboxGroup | RawCheckbox;
|
|
226
226
|
}
|
|
227
227
|
/** https://discord.com/developers/docs/components/reference#label-label-interaction-response-structure */
|
|
228
228
|
export interface RawLabelInteractionResponse {
|
|
229
229
|
type: ComponentTypes.Label;
|
|
230
230
|
id: number;
|
|
231
|
-
component: RawTextInputInteractionResponse | RawStringSelectInteractionResponse | RawUserSelectInteractionResponse | RawRoleSelectInteractionResponse | RawMentionableSelectInteractionResponse | RawChannelSelectInteractionResponse | RawFileUploadInteractionResponse;
|
|
231
|
+
component: RawTextInputInteractionResponse | RawStringSelectInteractionResponse | RawUserSelectInteractionResponse | RawRoleSelectInteractionResponse | RawMentionableSelectInteractionResponse | RawChannelSelectInteractionResponse | RawFileUploadInteractionResponse | RawRadioGroupInteractionResponse | RawCheckboxGroupInteractionResponse | RawCheckboxInteractionResponse;
|
|
232
232
|
}
|
|
233
233
|
/** https://discord.com/developers/docs/components/reference#file-upload-file-upload-structure */
|
|
234
234
|
export interface RawFileUpload {
|
|
@@ -255,6 +255,66 @@ export interface RawUnfurledMediaItem {
|
|
|
255
255
|
content_type?: string;
|
|
256
256
|
attachment_id?: snowflake;
|
|
257
257
|
}
|
|
258
|
+
/** https://docs.discord.com/developers/components/reference#radio-group-structure */
|
|
259
|
+
export interface RawRadioGroup {
|
|
260
|
+
type: ComponentTypes.RadioGroup;
|
|
261
|
+
id?: number;
|
|
262
|
+
custom_id: string;
|
|
263
|
+
options: Array<RawRadioGroupOptions>;
|
|
264
|
+
required?: boolean;
|
|
265
|
+
}
|
|
266
|
+
/** https://docs.discord.com/developers/components/reference#radio-group-option-structure */
|
|
267
|
+
export interface RawRadioGroupOptions {
|
|
268
|
+
value: string;
|
|
269
|
+
label: string;
|
|
270
|
+
description?: string;
|
|
271
|
+
default?: boolean;
|
|
272
|
+
}
|
|
273
|
+
/** https://docs.discord.com/developers/components/reference#radio-group-interaction-response-structure */
|
|
274
|
+
export interface RawRadioGroupInteractionResponse {
|
|
275
|
+
type: ComponentTypes.RadioGroup;
|
|
276
|
+
id: number;
|
|
277
|
+
custom_id: string;
|
|
278
|
+
value: string | null;
|
|
279
|
+
}
|
|
280
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-group-structure */
|
|
281
|
+
export interface RawCheckboxGroup {
|
|
282
|
+
type: ComponentTypes.CheckboxGroup;
|
|
283
|
+
id?: number;
|
|
284
|
+
custom_id: string;
|
|
285
|
+
options: Array<RawCheckboxGroupOptions>;
|
|
286
|
+
min_values?: number;
|
|
287
|
+
max_values?: number;
|
|
288
|
+
required?: boolean;
|
|
289
|
+
}
|
|
290
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-group-option-structure */
|
|
291
|
+
export interface RawCheckboxGroupOptions {
|
|
292
|
+
value: string;
|
|
293
|
+
label: string;
|
|
294
|
+
description?: string;
|
|
295
|
+
default?: boolean;
|
|
296
|
+
}
|
|
297
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-group-interaction-response-structure */
|
|
298
|
+
export interface RawCheckboxGroupInteractionResponse {
|
|
299
|
+
type: ComponentTypes.CheckboxGroup;
|
|
300
|
+
id: number;
|
|
301
|
+
custom_id: string;
|
|
302
|
+
values: Array<string>;
|
|
303
|
+
}
|
|
304
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-structure */
|
|
305
|
+
export interface RawCheckbox {
|
|
306
|
+
type: ComponentTypes.Checkbox;
|
|
307
|
+
id?: number;
|
|
308
|
+
custom_id: string;
|
|
309
|
+
default?: boolean;
|
|
310
|
+
}
|
|
311
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-interaction-response-structure */
|
|
312
|
+
export interface RawCheckboxInteractionResponse {
|
|
313
|
+
type: ComponentTypes.Checkbox;
|
|
314
|
+
id: number;
|
|
315
|
+
custom_id: string;
|
|
316
|
+
value: boolean;
|
|
317
|
+
}
|
|
258
318
|
/** https://discord.com/developers/docs/components/reference#action-row-action-row-structure */
|
|
259
319
|
export interface ActionRow {
|
|
260
320
|
type: ComponentTypes.ActionRow;
|
|
@@ -475,13 +535,13 @@ export interface Label {
|
|
|
475
535
|
id?: number;
|
|
476
536
|
label: string;
|
|
477
537
|
description?: string;
|
|
478
|
-
component: TextInput | StringSelect | UserSelect | RoleSelect | MentionableSelect | ChannelSelect | FileUpload;
|
|
538
|
+
component: TextInput | StringSelect | UserSelect | RoleSelect | MentionableSelect | ChannelSelect | FileUpload | RadioGroup | CheckboxGroup | Checkbox;
|
|
479
539
|
}
|
|
480
540
|
/** https://discord.com/developers/docs/components/reference#label-label-interaction-response-structure */
|
|
481
541
|
export interface LabelInteractionResponse {
|
|
482
542
|
type: ComponentTypes.Label;
|
|
483
543
|
id: number;
|
|
484
|
-
component: TextInputInteractionResponse | StringSelectInteractionResponse | UserSelectInteractionResponse | RoleSelectInteractionResponse | MentionableSelectInteractionResponse | ChannelSelectInteractionResponse | FileUploadInteractionResponse;
|
|
544
|
+
component: TextInputInteractionResponse | StringSelectInteractionResponse | UserSelectInteractionResponse | RoleSelectInteractionResponse | MentionableSelectInteractionResponse | ChannelSelectInteractionResponse | FileUploadInteractionResponse | RadioGroupInteractionResponse | CheckboxGroupInteractionResponse | CheckboxInteractionResponse;
|
|
485
545
|
}
|
|
486
546
|
/** https://discord.com/developers/docs/components/reference#file-upload-file-upload-structure */
|
|
487
547
|
export interface FileUpload {
|
|
@@ -508,3 +568,63 @@ export interface UnfurledMediaItem {
|
|
|
508
568
|
contentType?: string;
|
|
509
569
|
attachmentId?: snowflake;
|
|
510
570
|
}
|
|
571
|
+
/** https://docs.discord.com/developers/components/reference#radio-group-structure */
|
|
572
|
+
export interface RadioGroup {
|
|
573
|
+
type: ComponentTypes.RadioGroup;
|
|
574
|
+
id?: number;
|
|
575
|
+
customId: string;
|
|
576
|
+
options: Array<RadioGroupOptions>;
|
|
577
|
+
required?: boolean;
|
|
578
|
+
}
|
|
579
|
+
/** https://docs.discord.com/developers/components/reference#radio-group-option-structure */
|
|
580
|
+
export interface RadioGroupOptions {
|
|
581
|
+
value: string;
|
|
582
|
+
label: string;
|
|
583
|
+
description?: string;
|
|
584
|
+
default?: boolean;
|
|
585
|
+
}
|
|
586
|
+
/** https://docs.discord.com/developers/components/reference#radio-group-interaction-response-structure */
|
|
587
|
+
export interface RadioGroupInteractionResponse {
|
|
588
|
+
type: ComponentTypes.RadioGroup;
|
|
589
|
+
id: number;
|
|
590
|
+
customId: string;
|
|
591
|
+
value: string | null;
|
|
592
|
+
}
|
|
593
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-group-structure */
|
|
594
|
+
export interface CheckboxGroup {
|
|
595
|
+
type: ComponentTypes.CheckboxGroup;
|
|
596
|
+
id?: number;
|
|
597
|
+
customId: string;
|
|
598
|
+
options: Array<CheckboxGroupOptions>;
|
|
599
|
+
minValues?: number;
|
|
600
|
+
maxValues?: number;
|
|
601
|
+
required?: boolean;
|
|
602
|
+
}
|
|
603
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-group-option-structure */
|
|
604
|
+
export interface CheckboxGroupOptions {
|
|
605
|
+
value: string;
|
|
606
|
+
label: string;
|
|
607
|
+
description?: string;
|
|
608
|
+
default?: boolean;
|
|
609
|
+
}
|
|
610
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-group-interaction-response-structure */
|
|
611
|
+
export interface CheckboxGroupInteractionResponse {
|
|
612
|
+
type: ComponentTypes.CheckboxGroup;
|
|
613
|
+
id: number;
|
|
614
|
+
customId: string;
|
|
615
|
+
values: Array<string>;
|
|
616
|
+
}
|
|
617
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-structure */
|
|
618
|
+
export interface Checkbox {
|
|
619
|
+
type: ComponentTypes.Checkbox;
|
|
620
|
+
id?: number;
|
|
621
|
+
customId: string;
|
|
622
|
+
default?: boolean;
|
|
623
|
+
}
|
|
624
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-interaction-response-structure */
|
|
625
|
+
export interface CheckboxInteractionResponse {
|
|
626
|
+
type: ComponentTypes.Checkbox;
|
|
627
|
+
id: number;
|
|
628
|
+
customId: string;
|
|
629
|
+
value: boolean;
|
|
630
|
+
}
|
|
@@ -267,6 +267,7 @@ export interface RawInviteCreateEvent {
|
|
|
267
267
|
temporary: boolean;
|
|
268
268
|
uses: number;
|
|
269
269
|
expires_at: timestamp | null;
|
|
270
|
+
roles_ids?: Array<snowflake>;
|
|
270
271
|
}
|
|
271
272
|
/** https://discord.com/developers/docs/events/gateway-events#invite-delete-invite-delete-event-fields */
|
|
272
273
|
export interface RawInviteDeleteEvent {
|
|
@@ -706,6 +707,7 @@ export interface InviteCreateEvent {
|
|
|
706
707
|
temporary: boolean;
|
|
707
708
|
uses: number;
|
|
708
709
|
expiresAt: timestamp | null;
|
|
710
|
+
roleIds?: Array<snowflake>;
|
|
709
711
|
}
|
|
710
712
|
/** https://discord.com/developers/docs/events/gateway-events#invite-delete-invite-delete-event-fields */
|
|
711
713
|
export interface InviteDeleteEvent {
|
|
@@ -4,12 +4,13 @@ import type { RawChannel, Channel } from "./channel";
|
|
|
4
4
|
import type { timestamp } from "./common";
|
|
5
5
|
import type { RawGuild, RawGuildMember, Guild, GuildMember } from "./guild";
|
|
6
6
|
import type { RawGuildScheduledEvent, GuildScheduledEvent } from "./guild-scheduled-event";
|
|
7
|
+
import type { RawRole, Role } from "./role";
|
|
7
8
|
import type { RawUser, User } from "./user";
|
|
8
9
|
/** https://discord.com/developers/docs/resources/invite#invite-object-invite-structure */
|
|
9
10
|
export interface RawInvite {
|
|
10
11
|
type: InviteTypes;
|
|
11
12
|
code: string;
|
|
12
|
-
guild?: RawGuild
|
|
13
|
+
guild?: Partial<RawGuild>;
|
|
13
14
|
channel: RawChannel;
|
|
14
15
|
inviter?: RawUser;
|
|
15
16
|
target_type?: InviteTargetTypes;
|
|
@@ -21,6 +22,7 @@ export interface RawInvite {
|
|
|
21
22
|
stage_instance?: RawInviteStageInstance;
|
|
22
23
|
guild_scheduled_event?: RawGuildScheduledEvent;
|
|
23
24
|
flags?: GuildInviteFlags;
|
|
25
|
+
roles?: Array<Pick<RawRole, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicode_emoji">>;
|
|
24
26
|
}
|
|
25
27
|
/** https://discord.com/developers/docs/resources/invite#invite-metadata-object-invite-metadata-structure */
|
|
26
28
|
export interface RawInviteMetadata {
|
|
@@ -41,7 +43,7 @@ export interface RawInviteStageInstance {
|
|
|
41
43
|
export interface Invite {
|
|
42
44
|
type: InviteTypes;
|
|
43
45
|
code: string;
|
|
44
|
-
guild?: Guild
|
|
46
|
+
guild?: Partial<Guild>;
|
|
45
47
|
channel: Channel;
|
|
46
48
|
inviter?: User;
|
|
47
49
|
targetType?: InviteTargetTypes;
|
|
@@ -53,6 +55,7 @@ export interface Invite {
|
|
|
53
55
|
stageInstance?: InviteStageInstance;
|
|
54
56
|
guildScheduledEvent?: GuildScheduledEvent;
|
|
55
57
|
flags?: GuildInviteFlags;
|
|
58
|
+
roles?: Array<Pick<Role, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicodeEmoji">>;
|
|
56
59
|
}
|
|
57
60
|
/** https://discord.com/developers/docs/resources/invite#invite-metadata-object-invite-metadata-structure */
|
|
58
61
|
export interface InviteMetadata {
|
package/dist/package.json
CHANGED