disgroove 3.0.1-dev.739a5a9 → 3.0.1-dev.b082a0c
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 +2 -1
- package/dist/lib/Client.js +8 -0
- package/dist/lib/constants.d.ts +15 -2
- package/dist/lib/constants.js +15 -1
- package/dist/lib/gateway/Dispatcher.js +6 -0
- package/dist/lib/transformers/Components.d.ts +7 -1
- package/dist/lib/transformers/Components.js +72 -0
- package/dist/lib/transformers/Guilds.js +10 -0
- package/dist/lib/transformers/Interactions.js +46 -0
- package/dist/lib/transformers/Invites.d.ts +3 -0
- package/dist/lib/transformers/Invites.js +32 -0
- package/dist/lib/transformers/Messages.js +16 -0
- package/dist/lib/transformers/Users.d.ts +3 -1
- package/dist/lib/transformers/Users.js +16 -10
- package/dist/lib/types/components.d.ts +124 -4
- package/dist/lib/types/gateway-events.d.ts +5 -1
- package/dist/lib/types/guild.d.ts +3 -1
- package/dist/lib/types/invite.d.ts +2 -2
- package/dist/lib/types/message.d.ts +38 -1
- 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
|
@@ -26,7 +26,7 @@ import type { User, ApplicationRoleConnection, Connection } from "./types/user";
|
|
|
26
26
|
import type { VoiceRegion, VoiceState } from "./types/voice";
|
|
27
27
|
import type { Webhook } from "./types/webhook";
|
|
28
28
|
import type { ClientOptions as WebSocketOptions } from "ws";
|
|
29
|
-
import type { Embed, AllowedMentions, Attachment, Message, MessageReference, MessagePin } from "./types/message";
|
|
29
|
+
import type { Embed, AllowedMentions, Attachment, Message, MessageReference, MessagePin, SharedClientTheme } from "./types/message";
|
|
30
30
|
import type { Subscription } from "./types/subscription";
|
|
31
31
|
import type { SoundboardSound } from "./types/soundboard";
|
|
32
32
|
import type { ActionRow, Button, ChannelSelect, Container, File, MediaGallery, MentionableSelect, RoleSelect, Section, Separator, StringSelect, TextDisplay, Thumbnail, UserSelect } from "./types/components";
|
|
@@ -316,6 +316,7 @@ export declare class Client extends EventEmitter {
|
|
|
316
316
|
flags?: MessageFlags;
|
|
317
317
|
enforceNonce?: boolean;
|
|
318
318
|
poll?: PollCreateParams;
|
|
319
|
+
sharedClientTheme?: SharedClientTheme;
|
|
319
320
|
}): Promise<Message>;
|
|
320
321
|
/** https://discord.com/developers/docs/resources/message#create-reaction */
|
|
321
322
|
createMessageReaction(channelId: snowflake, messageId: snowflake, emoji: string): void;
|
package/dist/lib/Client.js
CHANGED
|
@@ -652,6 +652,14 @@ class Client extends node_events_1.default {
|
|
|
652
652
|
layout_type: options.poll.layoutType,
|
|
653
653
|
}
|
|
654
654
|
: undefined,
|
|
655
|
+
shared_client_theme: options.sharedClientTheme !== undefined
|
|
656
|
+
? {
|
|
657
|
+
colors: options.sharedClientTheme.colors,
|
|
658
|
+
gradient_angle: options.sharedClientTheme.gradientAngle,
|
|
659
|
+
base_mix: options.sharedClientTheme.baseMix,
|
|
660
|
+
base_theme: options.sharedClientTheme.baseTheme,
|
|
661
|
+
}
|
|
662
|
+
: undefined,
|
|
655
663
|
},
|
|
656
664
|
files: options.files,
|
|
657
665
|
});
|
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 {
|
|
@@ -621,6 +624,13 @@ export declare enum AllowedMentionTypes {
|
|
|
621
624
|
UserMentions = "users",
|
|
622
625
|
EveryoneMentions = "everyone"
|
|
623
626
|
}
|
|
627
|
+
/** https://docs.discord.com/developers/resources/message#base-theme-types */
|
|
628
|
+
export declare enum BaseThemeTypes {
|
|
629
|
+
Dark = 1,
|
|
630
|
+
Light = 2,
|
|
631
|
+
Darker = 3,
|
|
632
|
+
Midnight = 4
|
|
633
|
+
}
|
|
624
634
|
/** https://discord.com/developers/docs/resources/message#get-reactions-reaction-types */
|
|
625
635
|
export declare enum ReactionTypes {
|
|
626
636
|
Normal = 0,
|
|
@@ -955,7 +965,10 @@ export declare enum VoiceCloseEventCodes {
|
|
|
955
965
|
Disconnect = 4014,
|
|
956
966
|
VoiceServerCrashed = 4015,
|
|
957
967
|
UnknownEncryptionMode = 4016,
|
|
958
|
-
|
|
968
|
+
ProtocolRequired = 4017,
|
|
969
|
+
BadRequest = 4020,
|
|
970
|
+
RateLimited = 4021,
|
|
971
|
+
CallTerminated = 4022
|
|
959
972
|
}
|
|
960
973
|
/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#http-http-response-codes */
|
|
961
974
|
export declare enum HTTPResponseCodes {
|
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.InviteTargetUsersJobStatusErrorCodes = 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.BaseThemeTypes = 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;
|
|
@@ -687,6 +690,14 @@ var AllowedMentionTypes;
|
|
|
687
690
|
AllowedMentionTypes["UserMentions"] = "users";
|
|
688
691
|
AllowedMentionTypes["EveryoneMentions"] = "everyone";
|
|
689
692
|
})(AllowedMentionTypes || (exports.AllowedMentionTypes = AllowedMentionTypes = {}));
|
|
693
|
+
/** https://docs.discord.com/developers/resources/message#base-theme-types */
|
|
694
|
+
var BaseThemeTypes;
|
|
695
|
+
(function (BaseThemeTypes) {
|
|
696
|
+
BaseThemeTypes[BaseThemeTypes["Dark"] = 1] = "Dark";
|
|
697
|
+
BaseThemeTypes[BaseThemeTypes["Light"] = 2] = "Light";
|
|
698
|
+
BaseThemeTypes[BaseThemeTypes["Darker"] = 3] = "Darker";
|
|
699
|
+
BaseThemeTypes[BaseThemeTypes["Midnight"] = 4] = "Midnight";
|
|
700
|
+
})(BaseThemeTypes || (exports.BaseThemeTypes = BaseThemeTypes = {}));
|
|
690
701
|
/** https://discord.com/developers/docs/resources/message#get-reactions-reaction-types */
|
|
691
702
|
var ReactionTypes;
|
|
692
703
|
(function (ReactionTypes) {
|
|
@@ -1044,7 +1055,10 @@ var VoiceCloseEventCodes;
|
|
|
1044
1055
|
VoiceCloseEventCodes[VoiceCloseEventCodes["Disconnect"] = 4014] = "Disconnect";
|
|
1045
1056
|
VoiceCloseEventCodes[VoiceCloseEventCodes["VoiceServerCrashed"] = 4015] = "VoiceServerCrashed";
|
|
1046
1057
|
VoiceCloseEventCodes[VoiceCloseEventCodes["UnknownEncryptionMode"] = 4016] = "UnknownEncryptionMode";
|
|
1058
|
+
VoiceCloseEventCodes[VoiceCloseEventCodes["ProtocolRequired"] = 4017] = "ProtocolRequired";
|
|
1047
1059
|
VoiceCloseEventCodes[VoiceCloseEventCodes["BadRequest"] = 4020] = "BadRequest";
|
|
1060
|
+
VoiceCloseEventCodes[VoiceCloseEventCodes["RateLimited"] = 4021] = "RateLimited";
|
|
1061
|
+
VoiceCloseEventCodes[VoiceCloseEventCodes["CallTerminated"] = 4022] = "CallTerminated";
|
|
1048
1062
|
})(VoiceCloseEventCodes || (exports.VoiceCloseEventCodes = VoiceCloseEventCodes = {}));
|
|
1049
1063
|
/** https://discord.com/developers/docs/topics/opcodes-and-status-codes#http-http-response-codes */
|
|
1050
1064
|
var HTTPResponseCodes;
|
|
@@ -208,6 +208,11 @@ exports.Handlers = {
|
|
|
208
208
|
}
|
|
209
209
|
: null
|
|
210
210
|
: undefined,
|
|
211
|
+
collectibles: data.collectibles !== undefined
|
|
212
|
+
? data.collectibles !== null
|
|
213
|
+
? transformers_1.Users.collectiblesFromRaw(data.collectibles)
|
|
214
|
+
: null
|
|
215
|
+
: undefined,
|
|
211
216
|
});
|
|
212
217
|
},
|
|
213
218
|
[constants_1.GatewayEvents.GuildMembersChunk]: (shard, data) => {
|
|
@@ -306,6 +311,7 @@ exports.Handlers = {
|
|
|
306
311
|
temporary: data.temporary,
|
|
307
312
|
uses: data.uses,
|
|
308
313
|
expiresAt: data.expires_at,
|
|
314
|
+
roleIds: data.roles_ids,
|
|
309
315
|
});
|
|
310
316
|
},
|
|
311
317
|
[constants_1.GatewayEvents.InviteDelete]: (shard, data) => {
|
|
@@ -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,
|
|
@@ -119,6 +119,11 @@ class Guilds {
|
|
|
119
119
|
}
|
|
120
120
|
: null
|
|
121
121
|
: undefined,
|
|
122
|
+
collectibles: guildMember.collectibles !== undefined
|
|
123
|
+
? guildMember.collectibles !== null
|
|
124
|
+
? Users_1.Users.collectiblesFromRaw(guildMember.collectibles)
|
|
125
|
+
: null
|
|
126
|
+
: undefined,
|
|
122
127
|
};
|
|
123
128
|
}
|
|
124
129
|
static guildMemberToRaw(guildMember) {
|
|
@@ -145,6 +150,11 @@ class Guilds {
|
|
|
145
150
|
}
|
|
146
151
|
: null
|
|
147
152
|
: undefined,
|
|
153
|
+
collectibles: guildMember.collectibles !== undefined
|
|
154
|
+
? guildMember.collectibles !== null
|
|
155
|
+
? Users_1.Users.collectiblesToRaw(guildMember.collectibles)
|
|
156
|
+
: null
|
|
157
|
+
: undefined,
|
|
148
158
|
};
|
|
149
159
|
}
|
|
150
160
|
static guildToRaw(guild) {
|
|
@@ -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
|
}
|
|
@@ -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) {
|
|
@@ -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
|
}
|
|
@@ -298,6 +298,14 @@ class Messages {
|
|
|
298
298
|
? Polls_1.Polls.pollFromRaw(message.poll)
|
|
299
299
|
: undefined,
|
|
300
300
|
call: message.call,
|
|
301
|
+
sharedClientTheme: message.shared_client_theme !== undefined
|
|
302
|
+
? {
|
|
303
|
+
colors: message.shared_client_theme.colors,
|
|
304
|
+
gradientAngle: message.shared_client_theme.gradient_angle,
|
|
305
|
+
baseMix: message.shared_client_theme.base_mix,
|
|
306
|
+
baseTheme: message.shared_client_theme.base_theme,
|
|
307
|
+
}
|
|
308
|
+
: undefined,
|
|
301
309
|
};
|
|
302
310
|
}
|
|
303
311
|
static messageToRaw(message) {
|
|
@@ -404,6 +412,14 @@ class Messages {
|
|
|
404
412
|
: undefined,
|
|
405
413
|
poll: message.poll !== undefined ? Polls_1.Polls.pollToRaw(message.poll) : undefined,
|
|
406
414
|
call: message.call,
|
|
415
|
+
shared_client_theme: message.sharedClientTheme !== undefined
|
|
416
|
+
? {
|
|
417
|
+
colors: message.sharedClientTheme.colors,
|
|
418
|
+
gradient_angle: message.sharedClientTheme.gradientAngle,
|
|
419
|
+
base_mix: message.sharedClientTheme.baseMix,
|
|
420
|
+
base_theme: message.sharedClientTheme.baseTheme,
|
|
421
|
+
}
|
|
422
|
+
: undefined,
|
|
407
423
|
};
|
|
408
424
|
}
|
|
409
425
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { Nameplate, RawNameplate, RawUser, User } from "../types/user";
|
|
1
|
+
import type { Collectibles, Nameplate, RawCollectibles, RawNameplate, RawUser, User } from "../types/user";
|
|
2
2
|
export declare class Users {
|
|
3
|
+
static collectiblesFromRaw(collectibles: RawCollectibles): Collectibles;
|
|
4
|
+
static collectiblesToRaw(collectibles: Collectibles): RawCollectibles;
|
|
3
5
|
static nameplateFromRaw(nameplate: RawNameplate): Nameplate;
|
|
4
6
|
static nameplateToRaw(nameplate: Nameplate): RawNameplate;
|
|
5
7
|
static userFromRaw(user: RawUser): User;
|
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Users = void 0;
|
|
4
4
|
class Users {
|
|
5
|
+
static collectiblesFromRaw(collectibles) {
|
|
6
|
+
return {
|
|
7
|
+
nameplate: collectibles.nameplate !== undefined
|
|
8
|
+
? this.nameplateFromRaw(collectibles.nameplate)
|
|
9
|
+
: undefined,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
static collectiblesToRaw(collectibles) {
|
|
13
|
+
return {
|
|
14
|
+
nameplate: collectibles.nameplate !== undefined
|
|
15
|
+
? this.nameplateToRaw(collectibles.nameplate)
|
|
16
|
+
: undefined,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
5
19
|
static nameplateFromRaw(nameplate) {
|
|
6
20
|
return {
|
|
7
21
|
skuId: nameplate.sku_id,
|
|
@@ -46,11 +60,7 @@ class Users {
|
|
|
46
60
|
: undefined,
|
|
47
61
|
collectibles: user.collectibles !== undefined
|
|
48
62
|
? user.collectibles !== null
|
|
49
|
-
?
|
|
50
|
-
nameplate: user.collectibles.nameplate !== undefined
|
|
51
|
-
? this.nameplateFromRaw(user.collectibles.nameplate)
|
|
52
|
-
: undefined,
|
|
53
|
-
}
|
|
63
|
+
? this.collectiblesFromRaw(user.collectibles)
|
|
54
64
|
: null
|
|
55
65
|
: undefined,
|
|
56
66
|
primaryGuild: user.primary_guild !== undefined
|
|
@@ -93,11 +103,7 @@ class Users {
|
|
|
93
103
|
: undefined,
|
|
94
104
|
collectibles: user.collectibles !== undefined
|
|
95
105
|
? user.collectibles !== null
|
|
96
|
-
?
|
|
97
|
-
nameplate: user.collectibles.nameplate !== undefined
|
|
98
|
-
? this.nameplateToRaw(user.collectibles.nameplate)
|
|
99
|
-
: undefined,
|
|
100
|
-
}
|
|
106
|
+
? this.collectiblesToRaw(user.collectibles)
|
|
101
107
|
: null
|
|
102
108
|
: undefined,
|
|
103
109
|
primary_guild: user.primaryGuild !== undefined
|
|
@@ -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
|
+
}
|
|
@@ -10,7 +10,7 @@ import { RawRole, Role } from "./role";
|
|
|
10
10
|
import type { RawSoundboardSound, SoundboardSound } from "./soundboard";
|
|
11
11
|
import type { RawStageInstance, StageInstance } from "./stage-instance";
|
|
12
12
|
import { RawSticker, Sticker } from "./sticker";
|
|
13
|
-
import type { RawUser, RawAvatarDecorationData, User, AvatarDecorationData } from "./user";
|
|
13
|
+
import type { RawUser, RawAvatarDecorationData, User, AvatarDecorationData, Collectibles, RawCollectibles } from "./user";
|
|
14
14
|
import type { RawVoiceState, VoiceState } from "./voice";
|
|
15
15
|
/** https://discord.com/developers/docs/events/gateway-events#payload-structure */
|
|
16
16
|
export interface RawPayload {
|
|
@@ -185,6 +185,7 @@ export interface RawGuildMemberUpdateEvent {
|
|
|
185
185
|
communication_disabled_until?: number | null;
|
|
186
186
|
flags?: GuildMemberFlags;
|
|
187
187
|
avatar_decoration_data?: RawAvatarDecorationData | null;
|
|
188
|
+
collectibles?: RawCollectibles | null;
|
|
188
189
|
}
|
|
189
190
|
/** https://discord.com/developers/docs/events/gateway-events#guild-members-chunk-guild-members-chunk-event-fields */
|
|
190
191
|
export interface RawGuildMembersChunkEvent {
|
|
@@ -267,6 +268,7 @@ export interface RawInviteCreateEvent {
|
|
|
267
268
|
temporary: boolean;
|
|
268
269
|
uses: number;
|
|
269
270
|
expires_at: timestamp | null;
|
|
271
|
+
roles_ids?: Array<snowflake>;
|
|
270
272
|
}
|
|
271
273
|
/** https://discord.com/developers/docs/events/gateway-events#invite-delete-invite-delete-event-fields */
|
|
272
274
|
export interface RawInviteDeleteEvent {
|
|
@@ -624,6 +626,7 @@ export interface GuildMemberUpdateEvent {
|
|
|
624
626
|
communicationDisabledUntil?: number | null;
|
|
625
627
|
flags?: GuildMemberFlags;
|
|
626
628
|
avatarDecorationData?: AvatarDecorationData | null;
|
|
629
|
+
collectibles?: Collectibles | null;
|
|
627
630
|
}
|
|
628
631
|
/** https://discord.com/developers/docs/events/gateway-events#guild-members-chunk-guild-members-chunk-event-fields */
|
|
629
632
|
export interface GuildMembersChunkEvent {
|
|
@@ -706,6 +709,7 @@ export interface InviteCreateEvent {
|
|
|
706
709
|
temporary: boolean;
|
|
707
710
|
uses: number;
|
|
708
711
|
expiresAt: timestamp | null;
|
|
712
|
+
roleIds?: Array<snowflake>;
|
|
709
713
|
}
|
|
710
714
|
/** https://discord.com/developers/docs/events/gateway-events#invite-delete-invite-delete-event-fields */
|
|
711
715
|
export interface InviteDeleteEvent {
|
|
@@ -4,7 +4,7 @@ import type { snowflake, timestamp } from "./common";
|
|
|
4
4
|
import type { RawEmoji, Emoji } from "./emoji";
|
|
5
5
|
import type { RawRole, Role } from "./role";
|
|
6
6
|
import type { RawSticker, Sticker } from "./sticker";
|
|
7
|
-
import type { AvatarDecorationData, RawAvatarDecorationData, RawUser, User } from "./user";
|
|
7
|
+
import type { AvatarDecorationData, Collectibles, RawAvatarDecorationData, RawCollectibles, RawUser, User } from "./user";
|
|
8
8
|
/** https://discord.com/developers/docs/resources/guild#guild-object-guild-structure */
|
|
9
9
|
export interface RawGuild {
|
|
10
10
|
id: snowflake;
|
|
@@ -102,6 +102,7 @@ export interface RawGuildMember {
|
|
|
102
102
|
communication_disabled_until?: timestamp | null;
|
|
103
103
|
unusual_dm_activity_until?: timestamp | null;
|
|
104
104
|
avatar_decoration_data?: RawAvatarDecorationData | null;
|
|
105
|
+
collectibles?: RawCollectibles | null;
|
|
105
106
|
}
|
|
106
107
|
/** https://discord.com/developers/docs/resources/guild#integration-object-integration-structure */
|
|
107
108
|
export interface RawIntegration {
|
|
@@ -286,6 +287,7 @@ export interface GuildMember {
|
|
|
286
287
|
communicationDisabledUntil?: timestamp | null;
|
|
287
288
|
unusualDMActivityUntil?: timestamp | null;
|
|
288
289
|
avatarDecorationData?: AvatarDecorationData | null;
|
|
290
|
+
collectibles?: Collectibles | null;
|
|
289
291
|
}
|
|
290
292
|
/** https://discord.com/developers/docs/resources/guild#integration-object-integration-structure */
|
|
291
293
|
export interface Integration {
|
|
@@ -22,7 +22,7 @@ export interface RawInvite {
|
|
|
22
22
|
stage_instance?: RawInviteStageInstance;
|
|
23
23
|
guild_scheduled_event?: RawGuildScheduledEvent;
|
|
24
24
|
flags?: GuildInviteFlags;
|
|
25
|
-
roles?: Array<RawRole
|
|
25
|
+
roles?: Array<Pick<RawRole, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicode_emoji">>;
|
|
26
26
|
}
|
|
27
27
|
/** https://discord.com/developers/docs/resources/invite#invite-metadata-object-invite-metadata-structure */
|
|
28
28
|
export interface RawInviteMetadata {
|
|
@@ -55,7 +55,7 @@ export interface Invite {
|
|
|
55
55
|
stageInstance?: InviteStageInstance;
|
|
56
56
|
guildScheduledEvent?: GuildScheduledEvent;
|
|
57
57
|
flags?: GuildInviteFlags;
|
|
58
|
-
roles?: Array<Role
|
|
58
|
+
roles?: Array<Pick<Role, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicodeEmoji">>;
|
|
59
59
|
}
|
|
60
60
|
/** https://discord.com/developers/docs/resources/invite#invite-metadata-object-invite-metadata-structure */
|
|
61
61
|
export interface InviteMetadata {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MessageTypes, MessageFlags, MessageActivityTypes, InteractionType, ApplicationIntegrationTypes, MessageReferenceTypes, AttachmentFlags, ChannelTypes, AllowedMentionTypes, EmbedTypes } from "../constants";
|
|
1
|
+
import type { MessageTypes, MessageFlags, MessageActivityTypes, InteractionType, ApplicationIntegrationTypes, MessageReferenceTypes, AttachmentFlags, ChannelTypes, AllowedMentionTypes, EmbedTypes, BaseThemeTypes } from "../constants";
|
|
2
2
|
import type { Application, RawApplication } from "./application";
|
|
3
3
|
import type { Channel, RawChannel } from "./channel";
|
|
4
4
|
import type { snowflake, timestamp } from "./common";
|
|
@@ -46,6 +46,7 @@ export interface RawMessage {
|
|
|
46
46
|
resolved?: RawResolvedData;
|
|
47
47
|
poll?: RawPoll;
|
|
48
48
|
call?: RawMessageCall;
|
|
49
|
+
shared_client_theme?: RawSharedClientTheme;
|
|
49
50
|
}
|
|
50
51
|
/** https://discord.com/developers/docs/resources/message#message-object-message-activity-structure */
|
|
51
52
|
export interface RawMessageActivity {
|
|
@@ -208,6 +209,14 @@ export interface RawMessagePin {
|
|
|
208
209
|
pinnet_at: timestamp;
|
|
209
210
|
message: RawMessage;
|
|
210
211
|
}
|
|
212
|
+
/** https://docs.discord.com/developers/resources/message#shared-client-theme-object */
|
|
213
|
+
export interface RawSharedClientTheme {
|
|
214
|
+
colors: Array<string>;
|
|
215
|
+
gradient_angle: number;
|
|
216
|
+
base_mix: number;
|
|
217
|
+
base_theme?: BaseThemeTypes | null;
|
|
218
|
+
}
|
|
219
|
+
/** https://discord.com/developers/docs/resources/message#message-object-message-structure */
|
|
211
220
|
export interface Message {
|
|
212
221
|
id: snowflake;
|
|
213
222
|
channelId: snowflake;
|
|
@@ -245,11 +254,14 @@ export interface Message {
|
|
|
245
254
|
resolved?: ResolvedData;
|
|
246
255
|
poll?: Poll;
|
|
247
256
|
call?: MessageCall;
|
|
257
|
+
sharedClientTheme?: SharedClientTheme;
|
|
248
258
|
}
|
|
259
|
+
/** https://discord.com/developers/docs/resources/message#message-object-message-activity-structure */
|
|
249
260
|
export interface MessageActivity {
|
|
250
261
|
type: MessageActivityTypes;
|
|
251
262
|
partyId?: string;
|
|
252
263
|
}
|
|
264
|
+
/** https://discord.com/developers/docs/resources/message#message-interaction-metadata-object-message-interaction-metadata-structure */
|
|
253
265
|
export interface MessageInteractionMetadata {
|
|
254
266
|
id: snowflake;
|
|
255
267
|
type: InteractionType;
|
|
@@ -259,10 +271,12 @@ export interface MessageInteractionMetadata {
|
|
|
259
271
|
interactedMessageId?: snowflake;
|
|
260
272
|
triggeringInteractionMetadata?: MessageInteractionMetadata;
|
|
261
273
|
}
|
|
274
|
+
/** https://discord.com/developers/docs/resources/message#message-call-object-message-call-object-structure */
|
|
262
275
|
export interface MessageCall {
|
|
263
276
|
partecipants: Array<snowflake>;
|
|
264
277
|
endedTimestamp?: timestamp | null;
|
|
265
278
|
}
|
|
279
|
+
/** https://discord.com/developers/docs/resources/message#message-reference-object-message-reference-structure */
|
|
266
280
|
export interface MessageReference {
|
|
267
281
|
type?: MessageReferenceTypes;
|
|
268
282
|
messageId?: snowflake;
|
|
@@ -270,9 +284,11 @@ export interface MessageReference {
|
|
|
270
284
|
guildId?: snowflake;
|
|
271
285
|
failIfNotExists?: boolean;
|
|
272
286
|
}
|
|
287
|
+
/** https://discord.com/developers/docs/resources/message#message-snapshot-object-message-snapshot-structure */
|
|
273
288
|
export interface MessageSnapshot {
|
|
274
289
|
message: Pick<Message, "type" | "content" | "embeds" | "attachments" | "timestamp" | "editedTimestamp" | "flags" | "mentions" | "mentionRoles" | "stickers" | "stickerItems" | "components">;
|
|
275
290
|
}
|
|
291
|
+
/** https://discord.com/developers/docs/resources/message#reaction-object-reaction-structure */
|
|
276
292
|
export interface Reaction {
|
|
277
293
|
count: number;
|
|
278
294
|
countDetails: ReactionCountDetails;
|
|
@@ -281,10 +297,12 @@ export interface Reaction {
|
|
|
281
297
|
emoji: Emoji;
|
|
282
298
|
burstColors: Array<string>;
|
|
283
299
|
}
|
|
300
|
+
/** https://discord.com/developers/docs/resources/message#reaction-count-details-object-reaction-count-details-structure */
|
|
284
301
|
export interface ReactionCountDetails {
|
|
285
302
|
burst: number;
|
|
286
303
|
normal: number;
|
|
287
304
|
}
|
|
305
|
+
/** https://discord.com/developers/docs/resources/message#embed-object-embed-structure */
|
|
288
306
|
export interface Embed {
|
|
289
307
|
title?: string;
|
|
290
308
|
type?: EmbedTypes;
|
|
@@ -300,44 +318,52 @@ export interface Embed {
|
|
|
300
318
|
author?: EmbedAuthor;
|
|
301
319
|
fields?: Array<EmbedField>;
|
|
302
320
|
}
|
|
321
|
+
/** https://discord.com/developers/docs/resources/message#embed-object-embed-thumbnail-structure */
|
|
303
322
|
export interface EmbedThumbnail {
|
|
304
323
|
url: string;
|
|
305
324
|
proxyURL?: string;
|
|
306
325
|
height?: number;
|
|
307
326
|
width?: number;
|
|
308
327
|
}
|
|
328
|
+
/** https://discord.com/developers/docs/resources/message#embed-object-embed-video-structure */
|
|
309
329
|
export interface EmbedVideo {
|
|
310
330
|
url?: string;
|
|
311
331
|
proxyURL?: string;
|
|
312
332
|
height?: number;
|
|
313
333
|
width?: number;
|
|
314
334
|
}
|
|
335
|
+
/** https://discord.com/developers/docs/resources/message#embed-object-embed-image-structure */
|
|
315
336
|
export interface EmbedImage {
|
|
316
337
|
url: string;
|
|
317
338
|
proxyURL?: string;
|
|
318
339
|
height?: number;
|
|
319
340
|
width?: number;
|
|
320
341
|
}
|
|
342
|
+
/** https://discord.com/developers/docs/resources/message#embed-object-embed-provider-structure */
|
|
321
343
|
export interface EmbedProvider {
|
|
322
344
|
name?: string;
|
|
323
345
|
url?: string;
|
|
324
346
|
}
|
|
347
|
+
/** https://discord.com/developers/docs/resources/message#embed-object-embed-author-structure */
|
|
325
348
|
export interface EmbedAuthor {
|
|
326
349
|
name: string;
|
|
327
350
|
url?: string;
|
|
328
351
|
iconURL?: string;
|
|
329
352
|
proxyIconURL?: string;
|
|
330
353
|
}
|
|
354
|
+
/** https://discord.com/developers/docs/resources/message#embed-object-embed-footer-structure */
|
|
331
355
|
export interface EmbedFooter {
|
|
332
356
|
text: string;
|
|
333
357
|
iconURL?: string;
|
|
334
358
|
proxyIconURL?: string;
|
|
335
359
|
}
|
|
360
|
+
/** https://discord.com/developers/docs/resources/message#embed-object-embed-field-structure */
|
|
336
361
|
export interface EmbedField {
|
|
337
362
|
name: string;
|
|
338
363
|
value: string;
|
|
339
364
|
inline?: boolean;
|
|
340
365
|
}
|
|
366
|
+
/** https://discord.com/developers/docs/resources/message#embed-fields-by-embed-type-poll-result-embed-fields */
|
|
341
367
|
export interface PollResultEmbedFields {
|
|
342
368
|
pollQuestionText: string;
|
|
343
369
|
victorAnswerVotes: Array<number>;
|
|
@@ -348,6 +374,7 @@ export interface PollResultEmbedFields {
|
|
|
348
374
|
victorAnswerEmojiName?: string;
|
|
349
375
|
victorAnswerEmojiAnimated?: boolean;
|
|
350
376
|
}
|
|
377
|
+
/** https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure */
|
|
351
378
|
export interface Attachment {
|
|
352
379
|
id: snowflake;
|
|
353
380
|
filename: string;
|
|
@@ -364,12 +391,14 @@ export interface Attachment {
|
|
|
364
391
|
waveform?: boolean;
|
|
365
392
|
flags?: AttachmentFlags;
|
|
366
393
|
}
|
|
394
|
+
/** https://discord.com/developers/docs/resources/message#channel-mention-object-channel-mention-structure */
|
|
367
395
|
export interface ChannelMention {
|
|
368
396
|
id: snowflake;
|
|
369
397
|
guildId: snowflake;
|
|
370
398
|
type: ChannelTypes;
|
|
371
399
|
name: string;
|
|
372
400
|
}
|
|
401
|
+
/** https://discord.com/developers/docs/resources/message#allowed-mentions-object-allowed-mentions-structure */
|
|
373
402
|
export interface AllowedMentions {
|
|
374
403
|
parse?: Array<AllowedMentionTypes>;
|
|
375
404
|
roles?: Array<snowflake>;
|
|
@@ -383,7 +412,15 @@ export interface RoleSubscriptionData {
|
|
|
383
412
|
totalMonthsSubscribed: number;
|
|
384
413
|
isRenewal: boolean;
|
|
385
414
|
}
|
|
415
|
+
/** https://discord.com/developers/docs/resources/message#message-pin-object-message-pin-structure */
|
|
386
416
|
export interface MessagePin {
|
|
387
417
|
pinnetAt: timestamp;
|
|
388
418
|
message: Message;
|
|
389
419
|
}
|
|
420
|
+
/** https://docs.discord.com/developers/resources/message#shared-client-theme-object */
|
|
421
|
+
export interface SharedClientTheme {
|
|
422
|
+
colors: Array<string>;
|
|
423
|
+
gradientAngle: number;
|
|
424
|
+
baseMix: number;
|
|
425
|
+
baseTheme?: BaseThemeTypes | null;
|
|
426
|
+
}
|
package/dist/package.json
CHANGED