@velliajs/discord 1.0.3 → 1.0.4
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/package.json +1 -1
- package/src/client/BaseClient.js +7 -28
- package/src/client/Client.js +116 -283
- package/src/client/WebhookClient.js +17 -59
- package/src/client/actions/Action.js +0 -10
- package/src/client/actions/ActionsManager.js +3 -3
- package/src/client/actions/ApplicationCommandPermissionsUpdate.js +2 -15
- package/src/client/actions/AutoModerationActionExecution.js +1 -6
- package/src/client/actions/AutoModerationRuleCreate.js +1 -6
- package/src/client/actions/AutoModerationRuleDelete.js +1 -6
- package/src/client/actions/AutoModerationRuleUpdate.js +1 -7
- package/src/client/actions/ChannelCreate.js +1 -5
- package/src/client/actions/ChannelDelete.js +1 -5
- package/src/client/actions/GuildAuditLogEntryCreate.js +1 -6
- package/src/client/actions/GuildBanAdd.js +1 -5
- package/src/client/actions/GuildBanRemove.js +1 -5
- package/src/client/actions/GuildDelete.js +6 -14
- package/src/client/actions/GuildEmojiCreate.js +1 -5
- package/src/client/actions/GuildEmojiDelete.js +1 -5
- package/src/client/actions/GuildEmojiUpdate.js +1 -6
- package/src/client/actions/GuildEmojisUpdate.js +4 -4
- package/src/client/actions/GuildIntegrationsUpdate.js +1 -5
- package/src/client/actions/GuildMemberRemove.js +1 -5
- package/src/client/actions/GuildMemberUpdate.js +2 -11
- package/src/client/actions/GuildRoleCreate.js +1 -5
- package/src/client/actions/GuildRoleDelete.js +1 -5
- package/src/client/actions/GuildRoleUpdate.js +1 -6
- package/src/client/actions/GuildScheduledEventCreate.js +1 -5
- package/src/client/actions/GuildScheduledEventDelete.js +1 -5
- package/src/client/actions/GuildScheduledEventUpdate.js +1 -6
- package/src/client/actions/GuildScheduledEventUserAdd.js +1 -6
- package/src/client/actions/GuildScheduledEventUserRemove.js +1 -6
- package/src/client/actions/GuildStickerCreate.js +1 -5
- package/src/client/actions/GuildStickerDelete.js +1 -5
- package/src/client/actions/GuildStickerUpdate.js +1 -6
- package/src/client/actions/GuildStickersUpdate.js +4 -4
- package/src/client/actions/GuildUpdate.js +1 -6
- package/src/client/actions/InteractionCreate.js +3 -7
- package/src/client/actions/InviteCreate.js +1 -7
- package/src/client/actions/InviteDelete.js +1 -7
- package/src/client/actions/MessageCreate.js +1 -5
- package/src/client/actions/MessageDelete.js +1 -5
- package/src/client/actions/MessageDeleteBulk.js +1 -6
- package/src/client/actions/MessageReactionAdd.js +5 -18
- package/src/client/actions/MessageReactionRemove.js +5 -16
- package/src/client/actions/MessageReactionRemoveAll.js +4 -9
- package/src/client/actions/MessageReactionRemoveEmoji.js +1 -5
- package/src/client/actions/PresenceUpdate.js +1 -6
- package/src/client/actions/StageInstanceCreate.js +1 -5
- package/src/client/actions/StageInstanceDelete.js +1 -5
- package/src/client/actions/StageInstanceUpdate.js +1 -6
- package/src/client/actions/ThreadCreate.js +1 -6
- package/src/client/actions/ThreadDelete.js +1 -5
- package/src/client/actions/ThreadListSync.js +2 -7
- package/src/client/actions/ThreadMemberUpdate.js +2 -7
- package/src/client/actions/ThreadMembersUpdate.js +2 -9
- package/src/client/actions/TypingStart.js +1 -5
- package/src/client/actions/UserUpdate.js +1 -8
- package/src/client/actions/VoiceStateUpdate.js +4 -9
- package/src/client/actions/WebhooksUpdate.js +1 -6
- package/src/client/voice/ClientVoiceManager.js +3 -13
- package/src/client/websocket/WebSocketManager.js +25 -117
- package/src/client/websocket/WebSocketShard.js +29 -116
- package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js +2 -8
- package/src/client/websocket/handlers/CHANNEL_UPDATE.js +1 -6
- package/src/client/websocket/handlers/GUILD_CREATE.js +3 -7
- package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js +2 -16
- package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +1 -5
- package/src/client/websocket/handlers/MESSAGE_UPDATE.js +1 -6
- package/src/client/websocket/handlers/RESUMED.js +1 -6
- package/src/client/websocket/handlers/THREAD_UPDATE.js +1 -6
- package/src/errors/DJSError.js +3 -14
- package/src/errors/ErrorCodes.js +2 -164
- package/src/index.js +6 -6
- package/src/managers/ApplicationCommandManager.js +14 -130
- package/src/managers/ApplicationCommandPermissionsManager.js +31 -202
- package/src/managers/AutoModerationRuleManager.js +17 -145
- package/src/managers/BaseGuildEmojiManager.js +7 -38
- package/src/managers/BaseManager.js +2 -10
- package/src/managers/CachedManager.js +3 -17
- package/src/managers/CategoryChannelChildManager.js +6 -48
- package/src/managers/ChannelManager.js +11 -52
- package/src/managers/DataManager.js +5 -27
- package/src/managers/GuildApplicationCommandManager.js +3 -12
- package/src/managers/GuildBanManager.js +16 -105
- package/src/managers/GuildChannelManager.js +31 -226
- package/src/managers/GuildEmojiManager.js +9 -65
- package/src/managers/GuildEmojiRoleManager.js +8 -47
- package/src/managers/GuildForumThreadManager.js +5 -39
- package/src/managers/GuildInviteManager.js +18 -117
- package/src/managers/GuildManager.js +14 -115
- package/src/managers/GuildMemberManager.js +38 -256
- package/src/managers/GuildMemberRoleManager.js +13 -76
- package/src/managers/GuildScheduledEventManager.js +25 -128
- package/src/managers/GuildStickerManager.js +16 -96
- package/src/managers/GuildTextThreadManager.js +4 -47
- package/src/managers/MessageManager.js +23 -137
- package/src/managers/PermissionOverwriteManager.js +10 -78
- package/src/managers/PresenceManager.js +6 -27
- package/src/managers/ReactionManager.js +7 -40
- package/src/managers/ReactionUserManager.js +6 -29
- package/src/managers/RoleManager.js +29 -177
- package/src/managers/StageInstanceManager.js +14 -77
- package/src/managers/ThreadManager.js +23 -113
- package/src/managers/ThreadMemberManager.js +20 -89
- package/src/managers/UserManager.js +13 -65
- package/src/managers/VoiceStateManager.js +3 -13
- package/src/sharding/Shard.js +42 -158
- package/src/sharding/ShardClientUtil.js +17 -101
- package/src/sharding/ShardingManager.js +34 -151
- package/src/structures/ActionRow.js +4 -21
- package/src/structures/ActionRowBuilder.js +3 -13
- package/src/structures/AnonymousGuild.js +10 -43
- package/src/structures/ApplicationCommand.js +54 -308
- package/src/structures/ApplicationRoleConnectionMetadata.js +7 -27
- package/src/structures/Attachment.js +16 -65
- package/src/structures/AttachmentBuilder.js +13 -58
- package/src/structures/AutoModerationActionExecution.js +16 -69
- package/src/structures/AutoModerationRule.js +32 -164
- package/src/structures/AutocompleteInteraction.js +10 -52
- package/src/structures/Base.js +2 -10
- package/src/structures/BaseChannel.js +16 -80
- package/src/structures/BaseGuild.js +13 -59
- package/src/structures/BaseGuildEmoji.js +5 -21
- package/src/structures/BaseGuildTextChannel.js +19 -100
- package/src/structures/BaseGuildVoiceChannel.js +21 -110
- package/src/structures/BaseInteraction.js +40 -196
- package/src/structures/BaseSelectMenuComponent.js +6 -29
- package/src/structures/ButtonBuilder.js +4 -18
- package/src/structures/ButtonComponent.js +7 -34
- package/src/structures/ButtonInteraction.js +1 -4
- package/src/structures/CategoryChannel.js +5 -30
- package/src/structures/ChannelSelectMenuBuilder.js +3 -13
- package/src/structures/ChannelSelectMenuComponent.js +2 -9
- package/src/structures/ChannelSelectMenuInteraction.js +3 -12
- package/src/structures/ChatInputCommandInteraction.js +3 -13
- package/src/structures/ClientApplication.js +20 -83
- package/src/structures/ClientPresence.js +5 -20
- package/src/structures/ClientUser.js +21 -118
- package/src/structures/CommandInteraction.js +21 -96
- package/src/structures/CommandInteractionOptionResolver.js +26 -147
- package/src/structures/Component.js +5 -21
- package/src/structures/ContextMenuCommandInteraction.js +4 -18
- package/src/structures/DMChannel.js +17 -52
- package/src/structures/DirectoryChannel.js +4 -16
- package/src/structures/Embed.js +21 -107
- package/src/structures/EmbedBuilder.js +4 -18
- package/src/structures/Emoji.js +12 -60
- package/src/structures/ForumChannel.js +30 -140
- package/src/structures/Guild.js +117 -697
- package/src/structures/GuildAuditLogs.js +7 -32
- package/src/structures/GuildAuditLogsEntry.js +27 -135
- package/src/structures/GuildBan.js +6 -26
- package/src/structures/GuildChannel.js +36 -188
- package/src/structures/GuildEmoji.js +13 -67
- package/src/structures/GuildMember.js +47 -270
- package/src/structures/GuildPreview.js +19 -84
- package/src/structures/GuildPreviewEmoji.js +3 -13
- package/src/structures/GuildScheduledEvent.js +46 -250
- package/src/structures/GuildTemplate.js +24 -108
- package/src/structures/Integration.js +25 -103
- package/src/structures/IntegrationApplication.js +8 -32
- package/src/structures/InteractionCollector.js +22 -113
- package/src/structures/InteractionResponse.js +11 -46
- package/src/structures/InteractionWebhook.js +8 -33
- package/src/structures/Invite.js +27 -131
- package/src/structures/InviteGuild.js +2 -8
- package/src/structures/InviteStageInstance.js +9 -39
- package/src/structures/MentionableSelectMenuBuilder.js +3 -14
- package/src/structures/MentionableSelectMenuComponent.js +1 -4
- package/src/structures/MentionableSelectMenuInteraction.js +5 -20
- package/src/structures/Message.js +85 -460
- package/src/structures/MessageCollector.js +14 -70
- package/src/structures/MessageComponentInteraction.js +14 -57
- package/src/structures/MessageContextMenuCommandInteraction.js +2 -9
- package/src/structures/MessageMentions.js +25 -136
- package/src/structures/MessagePayload.js +24 -94
- package/src/structures/MessageReaction.js +13 -51
- package/src/structures/ModalBuilder.js +3 -13
- package/src/structures/ModalSubmitFields.js +5 -22
- package/src/structures/ModalSubmitInteraction.js +17 -61
- package/src/structures/NewsChannel.js +2 -16
- package/src/structures/OAuth2Guild.js +3 -12
- package/src/structures/PartialGroupDMChannel.js +7 -27
- package/src/structures/PermissionOverwrites.js +20 -99
- package/src/structures/Presence.js +45 -190
- package/src/structures/ReactionCollector.js +20 -108
- package/src/structures/ReactionEmoji.js +2 -10
- package/src/structures/Role.js +39 -261
- package/src/structures/RoleSelectMenuBuilder.js +3 -13
- package/src/structures/RoleSelectMenuComponent.js +1 -4
- package/src/structures/RoleSelectMenuInteraction.js +3 -12
- package/src/structures/SelectMenuBuilder.js +1 -4
- package/src/structures/SelectMenuComponent.js +1 -4
- package/src/structures/SelectMenuInteraction.js +1 -4
- package/src/structures/SelectMenuOptionBuilder.js +1 -4
- package/src/structures/StageChannel.js +12 -84
- package/src/structures/StageInstance.js +16 -87
- package/src/structures/Sticker.js +25 -124
- package/src/structures/StickerPack.js +12 -52
- package/src/structures/StringSelectMenuBuilder.js +6 -29
- package/src/structures/StringSelectMenuComponent.js +2 -9
- package/src/structures/StringSelectMenuInteraction.js +2 -8
- package/src/structures/StringSelectMenuOptionBuilder.js +4 -18
- package/src/structures/Team.js +11 -52
- package/src/structures/TeamMember.js +7 -33
- package/src/structures/TextChannel.js +3 -14
- package/src/structures/TextInputBuilder.js +3 -13
- package/src/structures/TextInputComponent.js +3 -14
- package/src/structures/ThreadChannel.js +59 -305
- package/src/structures/ThreadMember.js +12 -55
- package/src/structures/Typing.js +8 -35
- package/src/structures/User.js +29 -151
- package/src/structures/UserContextMenuCommandInteraction.js +3 -14
- package/src/structures/UserSelectMenuBuilder.js +3 -13
- package/src/structures/UserSelectMenuComponent.js +1 -4
- package/src/structures/UserSelectMenuInteraction.js +4 -16
- package/src/structures/VoiceChannel.js +8 -67
- package/src/structures/VoiceRegion.js +6 -23
- package/src/structures/VoiceState.js +28 -140
- package/src/structures/Webhook.js +37 -227
- package/src/structures/WelcomeChannel.js +7 -29
- package/src/structures/WelcomeScreen.js +5 -20
- package/src/structures/Widget.js +9 -40
- package/src/structures/WidgetMember.js +15 -61
- package/src/structures/interfaces/Application.js +10 -49
- package/src/structures/interfaces/Collector.js +34 -155
- package/src/structures/interfaces/InteractionResponses.js +25 -164
- package/src/structures/interfaces/TextBasedChannel.js +37 -232
- package/src/util/APITypes.js +183 -456
- package/src/util/ActivityFlagsBitField.js +3 -15
- package/src/util/ApplicationFlagsBitField.js +3 -15
- package/src/util/BitField.js +17 -82
- package/src/util/ChannelFlagsBitField.js +7 -30
- package/src/util/Channels.js +5 -35
- package/src/util/Colors.js +3 -38
- package/src/util/Components.js +21 -75
- package/src/util/Constants.js +17 -144
- package/src/util/DataResolver.js +20 -77
- package/src/util/Events.js +3 -81
- package/src/util/Formatters.js +58 -305
- package/src/util/GuildMemberFlagsBitField.js +7 -30
- package/src/util/IntentsBitField.js +4 -23
- package/src/util/LimitedCollection.js +4 -21
- package/src/util/MessageFlagsBitField.js +5 -21
- package/src/util/Options.js +24 -137
- package/src/util/Partials.js +3 -30
- package/src/util/PermissionsBitField.js +12 -67
- package/src/util/ShardEvents.js +3 -15
- package/src/util/Status.js +3 -17
- package/src/util/Sweepers.js +35 -184
- package/src/util/SystemChannelFlagsBitField.js +7 -32
- package/src/util/ThreadMemberFlagsBitField.js +5 -21
- package/src/util/Transformers.js +2 -11
- package/src/util/UserFlagsBitField.js +5 -21
- package/src/util/Util.js +30 -169
- package/src/util/WebSocketShardEvents.js +3 -14
|
@@ -5,10 +5,7 @@ const { isJSONEncodable } = require('@discordjs/util');
|
|
|
5
5
|
const { toSnakeCase } = require('../util/Transformers');
|
|
6
6
|
const { resolvePartialEmoji } = require('../util/Util');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
* Class used to build select menu components to be sent through the API
|
|
10
|
-
* @extends {BuildersSelectMenu}
|
|
11
|
-
*/
|
|
8
|
+
|
|
12
9
|
class StringSelectMenuBuilder extends BuildersSelectMenu {
|
|
13
10
|
constructor({ options, ...data } = {}) {
|
|
14
11
|
super(
|
|
@@ -22,12 +19,7 @@ class StringSelectMenuBuilder extends BuildersSelectMenu {
|
|
|
22
19
|
);
|
|
23
20
|
}
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
* Normalizes a select menu option emoji
|
|
27
|
-
* @param {SelectMenuOptionData|APISelectMenuOption} selectMenuOption The option to normalize
|
|
28
|
-
* @returns {SelectMenuOptionBuilder|APISelectMenuOption}
|
|
29
|
-
* @private
|
|
30
|
-
*/
|
|
22
|
+
|
|
31
23
|
static normalizeEmoji(selectMenuOption) {
|
|
32
24
|
if (isJSONEncodable(selectMenuOption)) {
|
|
33
25
|
return selectMenuOption;
|
|
@@ -40,29 +32,17 @@ class StringSelectMenuBuilder extends BuildersSelectMenu {
|
|
|
40
32
|
};
|
|
41
33
|
}
|
|
42
34
|
|
|
43
|
-
|
|
44
|
-
* Adds options to this select menu
|
|
45
|
-
* @param {RestOrArray<APISelectMenuOption>} options The options to add to this select menu
|
|
46
|
-
* @returns {StringSelectMenuBuilder}
|
|
47
|
-
*/
|
|
35
|
+
|
|
48
36
|
addOptions(...options) {
|
|
49
37
|
return super.addOptions(normalizeArray(options).map(option => StringSelectMenuBuilder.normalizeEmoji(option)));
|
|
50
38
|
}
|
|
51
39
|
|
|
52
|
-
|
|
53
|
-
* Sets the options on this select menu
|
|
54
|
-
* @param {RestOrArray<APISelectMenuOption>} options The options to set on this select menu
|
|
55
|
-
* @returns {StringSelectMenuBuilder}
|
|
56
|
-
*/
|
|
40
|
+
|
|
57
41
|
setOptions(...options) {
|
|
58
42
|
return super.setOptions(normalizeArray(options).map(option => StringSelectMenuBuilder.normalizeEmoji(option)));
|
|
59
43
|
}
|
|
60
44
|
|
|
61
|
-
|
|
62
|
-
* Creates a new select menu builder from json data
|
|
63
|
-
* @param {StringSelectMenuBuilder|StringSelectMenuComponent|APIStringSelectComponent} other The other data
|
|
64
|
-
* @returns {StringSelectMenuBuilder}
|
|
65
|
-
*/
|
|
45
|
+
|
|
66
46
|
static from(other) {
|
|
67
47
|
if (isJSONEncodable(other)) {
|
|
68
48
|
return new this(other.toJSON());
|
|
@@ -73,7 +53,4 @@ class StringSelectMenuBuilder extends BuildersSelectMenu {
|
|
|
73
53
|
|
|
74
54
|
module.exports = StringSelectMenuBuilder;
|
|
75
55
|
|
|
76
|
-
|
|
77
|
-
* @external BuildersSelectMenu
|
|
78
|
-
* @see {@link https://discord.js.org/docs/packages/builders/stable/StringSelectMenuBuilder:Class}
|
|
79
|
-
*/
|
|
56
|
+
|
|
@@ -2,16 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const BaseSelectMenuComponent = require('./BaseSelectMenuComponent');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
* Represents a string select menu component
|
|
7
|
-
* @extends {BaseSelectMenuComponent}
|
|
8
|
-
*/
|
|
5
|
+
|
|
9
6
|
class StringSelectMenuComponent extends BaseSelectMenuComponent {
|
|
10
|
-
|
|
11
|
-
* The options in this select menu
|
|
12
|
-
* @type {APISelectMenuOption[]}
|
|
13
|
-
* @readonly
|
|
14
|
-
*/
|
|
7
|
+
|
|
15
8
|
get options() {
|
|
16
9
|
return this.data.options;
|
|
17
10
|
}
|
|
@@ -2,18 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
const MessageComponentInteraction = require('./MessageComponentInteraction');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
* Represents a {@link ComponentType.StringSelect} select menu interaction.
|
|
7
|
-
* @extends {MessageComponentInteraction}
|
|
8
|
-
*/
|
|
5
|
+
|
|
9
6
|
class StringSelectMenuInteraction extends MessageComponentInteraction {
|
|
10
7
|
constructor(client, data) {
|
|
11
8
|
super(client, data);
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
* The values selected
|
|
15
|
-
* @type {string[]}
|
|
16
|
-
*/
|
|
10
|
+
|
|
17
11
|
this.values = data.data.values ?? [];
|
|
18
12
|
}
|
|
19
13
|
}
|
|
@@ -5,10 +5,7 @@ const { isJSONEncodable } = require('@discordjs/util');
|
|
|
5
5
|
const { toSnakeCase } = require('../util/Transformers');
|
|
6
6
|
const { resolvePartialEmoji } = require('../util/Util');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
* Represents a select menu option builder.
|
|
10
|
-
* @extends {BuildersSelectMenuOption}
|
|
11
|
-
*/
|
|
8
|
+
|
|
12
9
|
class StringSelectMenuOptionBuilder extends BuildersSelectMenuOption {
|
|
13
10
|
constructor({ emoji, ...data } = {}) {
|
|
14
11
|
super(
|
|
@@ -19,11 +16,7 @@ class StringSelectMenuOptionBuilder extends BuildersSelectMenuOption {
|
|
|
19
16
|
);
|
|
20
17
|
}
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
* Sets the emoji to display on this option
|
|
24
|
-
* @param {ComponentEmojiResolvable} emoji The emoji to display on this option
|
|
25
|
-
* @returns {StringSelectMenuOptionBuilder}
|
|
26
|
-
*/
|
|
19
|
+
|
|
27
20
|
setEmoji(emoji) {
|
|
28
21
|
if (typeof emoji === 'string') {
|
|
29
22
|
return super.setEmoji(resolvePartialEmoji(emoji));
|
|
@@ -31,11 +24,7 @@ class StringSelectMenuOptionBuilder extends BuildersSelectMenuOption {
|
|
|
31
24
|
return super.setEmoji(emoji);
|
|
32
25
|
}
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
* Creates a new select menu option builder from JSON data
|
|
36
|
-
* @param {StringSelectMenuOptionBuilder|APISelectMenuOption} other The other data
|
|
37
|
-
* @returns {StringSelectMenuOptionBuilder}
|
|
38
|
-
*/
|
|
27
|
+
|
|
39
28
|
static from(other) {
|
|
40
29
|
return new this(isJSONEncodable(other) ? other.toJSON() : other);
|
|
41
30
|
}
|
|
@@ -43,7 +32,4 @@ class StringSelectMenuOptionBuilder extends BuildersSelectMenuOption {
|
|
|
43
32
|
|
|
44
33
|
module.exports = StringSelectMenuOptionBuilder;
|
|
45
34
|
|
|
46
|
-
|
|
47
|
-
* @external BuildersSelectMenuOption
|
|
48
|
-
* @see {@link https://discord.js.org/docs/packages/builders/stable/SelectMenuOptionBuilder:Class}
|
|
49
|
-
*/
|
|
35
|
+
|
package/src/structures/Team.js
CHANGED
|
@@ -5,10 +5,7 @@ const { DiscordSnowflake } = require('@sapphire/snowflake');
|
|
|
5
5
|
const Base = require('./Base');
|
|
6
6
|
const TeamMember = require('./TeamMember');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
* Represents a Client OAuth2 Application Team.
|
|
10
|
-
* @extends {Base}
|
|
11
|
-
*/
|
|
8
|
+
|
|
12
9
|
class Team extends Base {
|
|
13
10
|
constructor(client, data) {
|
|
14
11
|
super(client);
|
|
@@ -16,43 +13,28 @@ class Team extends Base {
|
|
|
16
13
|
}
|
|
17
14
|
|
|
18
15
|
_patch(data) {
|
|
19
|
-
|
|
20
|
-
* The Team's id
|
|
21
|
-
* @type {Snowflake}
|
|
22
|
-
*/
|
|
16
|
+
|
|
23
17
|
this.id = data.id;
|
|
24
18
|
|
|
25
19
|
if ('name' in data) {
|
|
26
|
-
|
|
27
|
-
* The name of the Team
|
|
28
|
-
* @type {string}
|
|
29
|
-
*/
|
|
20
|
+
|
|
30
21
|
this.name = data.name;
|
|
31
22
|
}
|
|
32
23
|
|
|
33
24
|
if ('icon' in data) {
|
|
34
|
-
|
|
35
|
-
* The Team's icon hash
|
|
36
|
-
* @type {?string}
|
|
37
|
-
*/
|
|
25
|
+
|
|
38
26
|
this.icon = data.icon;
|
|
39
27
|
} else {
|
|
40
28
|
this.icon ??= null;
|
|
41
29
|
}
|
|
42
30
|
|
|
43
31
|
if ('owner_user_id' in data) {
|
|
44
|
-
|
|
45
|
-
* The Team's owner id
|
|
46
|
-
* @type {?Snowflake}
|
|
47
|
-
*/
|
|
32
|
+
|
|
48
33
|
this.ownerId = data.owner_user_id;
|
|
49
34
|
} else {
|
|
50
35
|
this.ownerId ??= null;
|
|
51
36
|
}
|
|
52
|
-
|
|
53
|
-
* The Team's members
|
|
54
|
-
* @type {Collection<Snowflake, TeamMember>}
|
|
55
|
-
*/
|
|
37
|
+
|
|
56
38
|
this.members = new Collection();
|
|
57
39
|
|
|
58
40
|
for (const memberData of data.members) {
|
|
@@ -61,50 +43,27 @@ class Team extends Base {
|
|
|
61
43
|
}
|
|
62
44
|
}
|
|
63
45
|
|
|
64
|
-
|
|
65
|
-
* The owner of this team
|
|
66
|
-
* @type {?TeamMember}
|
|
67
|
-
* @readonly
|
|
68
|
-
*/
|
|
46
|
+
|
|
69
47
|
get owner() {
|
|
70
48
|
return this.members.get(this.ownerId) ?? null;
|
|
71
49
|
}
|
|
72
50
|
|
|
73
|
-
|
|
74
|
-
* The timestamp the team was created at
|
|
75
|
-
* @type {number}
|
|
76
|
-
* @readonly
|
|
77
|
-
*/
|
|
51
|
+
|
|
78
52
|
get createdTimestamp() {
|
|
79
53
|
return DiscordSnowflake.timestampFrom(this.id);
|
|
80
54
|
}
|
|
81
55
|
|
|
82
|
-
|
|
83
|
-
* The time the team was created at
|
|
84
|
-
* @type {Date}
|
|
85
|
-
* @readonly
|
|
86
|
-
*/
|
|
56
|
+
|
|
87
57
|
get createdAt() {
|
|
88
58
|
return new Date(this.createdTimestamp);
|
|
89
59
|
}
|
|
90
60
|
|
|
91
|
-
|
|
92
|
-
* A link to the team's icon.
|
|
93
|
-
* @param {ImageURLOptions} [options={}] Options for the image URL
|
|
94
|
-
* @returns {?string}
|
|
95
|
-
*/
|
|
61
|
+
|
|
96
62
|
iconURL(options = {}) {
|
|
97
63
|
return this.icon && this.client.rest.cdn.teamIcon(this.id, this.icon, options);
|
|
98
64
|
}
|
|
99
65
|
|
|
100
|
-
|
|
101
|
-
* When concatenated with a string, this automatically returns the Team's name instead of the
|
|
102
|
-
* Team object.
|
|
103
|
-
* @returns {string}
|
|
104
|
-
* @example
|
|
105
|
-
* // Logs: Team name: My Team
|
|
106
|
-
* console.log(`Team name: ${team}`);
|
|
107
|
-
*/
|
|
66
|
+
|
|
108
67
|
toString() {
|
|
109
68
|
return this.name;
|
|
110
69
|
}
|
|
@@ -2,18 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
const Base = require('./Base');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
* Represents a Client OAuth2 Application Team Member.
|
|
7
|
-
* @extends {Base}
|
|
8
|
-
*/
|
|
5
|
+
|
|
9
6
|
class TeamMember extends Base {
|
|
10
7
|
constructor(team, data) {
|
|
11
8
|
super(team.client);
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
* The Team this member is part of
|
|
15
|
-
* @type {Team}
|
|
16
|
-
*/
|
|
10
|
+
|
|
17
11
|
this.team = team;
|
|
18
12
|
|
|
19
13
|
this._patch(data);
|
|
@@ -21,47 +15,27 @@ class TeamMember extends Base {
|
|
|
21
15
|
|
|
22
16
|
_patch(data) {
|
|
23
17
|
if ('permissions' in data) {
|
|
24
|
-
|
|
25
|
-
* The permissions this Team Member has with regard to the team
|
|
26
|
-
* @type {string[]}
|
|
27
|
-
*/
|
|
18
|
+
|
|
28
19
|
this.permissions = data.permissions;
|
|
29
20
|
}
|
|
30
21
|
|
|
31
22
|
if ('membership_state' in data) {
|
|
32
|
-
|
|
33
|
-
* The permissions this Team Member has with regard to the team
|
|
34
|
-
* @type {TeamMemberMembershipState}
|
|
35
|
-
*/
|
|
23
|
+
|
|
36
24
|
this.membershipState = data.membership_state;
|
|
37
25
|
}
|
|
38
26
|
|
|
39
27
|
if ('user' in data) {
|
|
40
|
-
|
|
41
|
-
* The user for this Team Member
|
|
42
|
-
* @type {User}
|
|
43
|
-
*/
|
|
28
|
+
|
|
44
29
|
this.user = this.client.users._add(data.user);
|
|
45
30
|
}
|
|
46
31
|
}
|
|
47
32
|
|
|
48
|
-
|
|
49
|
-
* The Team Member's id
|
|
50
|
-
* @type {Snowflake}
|
|
51
|
-
* @readonly
|
|
52
|
-
*/
|
|
33
|
+
|
|
53
34
|
get id() {
|
|
54
35
|
return this.user.id;
|
|
55
36
|
}
|
|
56
37
|
|
|
57
|
-
|
|
58
|
-
* When concatenated with a string, this automatically returns the team member's mention instead of the
|
|
59
|
-
* TeamMember object.
|
|
60
|
-
* @returns {string}
|
|
61
|
-
* @example
|
|
62
|
-
* // Logs: Team Member's mention: <@123456789012345678>
|
|
63
|
-
* console.log(`Team Member's mention: ${teamMember}`);
|
|
64
|
-
*/
|
|
38
|
+
|
|
65
39
|
toString() {
|
|
66
40
|
return this.user.toString();
|
|
67
41
|
}
|
|
@@ -2,29 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
const BaseGuildTextChannel = require('./BaseGuildTextChannel');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
* Represents a guild text channel on Discord.
|
|
7
|
-
* @extends {BaseGuildTextChannel}
|
|
8
|
-
*/
|
|
5
|
+
|
|
9
6
|
class TextChannel extends BaseGuildTextChannel {
|
|
10
7
|
_patch(data) {
|
|
11
8
|
super._patch(data);
|
|
12
9
|
|
|
13
10
|
if ('rate_limit_per_user' in data) {
|
|
14
|
-
|
|
15
|
-
* The rate limit per user (slowmode) for this channel in seconds
|
|
16
|
-
* @type {number}
|
|
17
|
-
*/
|
|
11
|
+
|
|
18
12
|
this.rateLimitPerUser = data.rate_limit_per_user;
|
|
19
13
|
}
|
|
20
14
|
}
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
* Sets the rate limit per user (slowmode) for this channel.
|
|
24
|
-
* @param {number} rateLimitPerUser The new rate limit in seconds
|
|
25
|
-
* @param {string} [reason] Reason for changing the channel's rate limit
|
|
26
|
-
* @returns {Promise<TextChannel>}
|
|
27
|
-
*/
|
|
16
|
+
|
|
28
17
|
setRateLimitPerUser(rateLimitPerUser, reason) {
|
|
29
18
|
return this.edit({ rateLimitPerUser, reason });
|
|
30
19
|
}
|
|
@@ -4,20 +4,13 @@ const { TextInputBuilder: BuildersTextInput } = require('@discordjs/builders');
|
|
|
4
4
|
const { isJSONEncodable } = require('@discordjs/util');
|
|
5
5
|
const { toSnakeCase } = require('../util/Transformers');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
* Represents a text input builder.
|
|
9
|
-
* @extends {BuildersTextInput}
|
|
10
|
-
*/
|
|
7
|
+
|
|
11
8
|
class TextInputBuilder extends BuildersTextInput {
|
|
12
9
|
constructor(data) {
|
|
13
10
|
super(toSnakeCase(data));
|
|
14
11
|
}
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
* Creates a new text input builder from JSON data
|
|
18
|
-
* @param {TextInputBuilder|TextInputComponent|APITextInputComponent} other The other data
|
|
19
|
-
* @returns {TextInputBuilder}
|
|
20
|
-
*/
|
|
13
|
+
|
|
21
14
|
static from(other) {
|
|
22
15
|
return new this(isJSONEncodable(other) ? other.toJSON() : other);
|
|
23
16
|
}
|
|
@@ -25,7 +18,4 @@ class TextInputBuilder extends BuildersTextInput {
|
|
|
25
18
|
|
|
26
19
|
module.exports = TextInputBuilder;
|
|
27
20
|
|
|
28
|
-
|
|
29
|
-
* @external BuildersTextInput
|
|
30
|
-
* @see {@link https://discord.js.org/docs/packages/builders/stable/TextInputBuilder:Class}
|
|
31
|
-
*/
|
|
21
|
+
|
|
@@ -2,25 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
const Component = require('./Component');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
* Represents a text input component.
|
|
7
|
-
* @extends {Component}
|
|
8
|
-
*/
|
|
5
|
+
|
|
9
6
|
class TextInputComponent extends Component {
|
|
10
|
-
|
|
11
|
-
* The custom id of this text input
|
|
12
|
-
* @type {string}
|
|
13
|
-
* @readonly
|
|
14
|
-
*/
|
|
7
|
+
|
|
15
8
|
get customId() {
|
|
16
9
|
return this.data.custom_id;
|
|
17
10
|
}
|
|
18
11
|
|
|
19
|
-
|
|
20
|
-
* The value for this text input
|
|
21
|
-
* @type {string}
|
|
22
|
-
* @readonly
|
|
23
|
-
*/
|
|
12
|
+
|
|
24
13
|
get value() {
|
|
25
14
|
return this.data.value;
|
|
26
15
|
}
|