djs-selfbot-v13 3.1.6 → 3.1.7
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 +31 -16
- package/package.json +15 -8
- package/src/client/BaseClient.js +3 -2
- package/src/client/Client.js +539 -187
- package/src/client/actions/Action.js +13 -18
- package/src/client/actions/ActionsManager.js +1 -7
- package/src/client/actions/AutoModerationActionExecution.js +0 -1
- package/src/client/actions/AutoModerationRuleCreate.js +0 -1
- package/src/client/actions/AutoModerationRuleDelete.js +0 -1
- package/src/client/actions/AutoModerationRuleUpdate.js +0 -1
- package/src/client/actions/InteractionCreate.js +115 -0
- package/src/client/actions/MessageCreate.js +4 -0
- package/src/client/actions/PresenceUpdate.js +16 -17
- package/src/client/websocket/WebSocketManager.js +31 -11
- package/src/client/websocket/WebSocketShard.js +38 -39
- package/src/client/websocket/handlers/APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE.js +23 -0
- package/src/client/websocket/handlers/CALL_CREATE.js +3 -3
- package/src/client/websocket/handlers/CALL_DELETE.js +2 -2
- package/src/client/websocket/handlers/CALL_UPDATE.js +2 -2
- package/src/client/websocket/handlers/CHANNEL_RECIPIENT_ADD.js +13 -16
- package/src/client/websocket/handlers/CHANNEL_RECIPIENT_REMOVE.js +11 -11
- package/src/client/websocket/handlers/GUILD_APPLICATION_COMMANDS_UPDATE.js +11 -0
- package/src/client/websocket/handlers/GUILD_CREATE.js +0 -7
- package/src/client/websocket/handlers/GUILD_MEMBER_LIST_UPDATE.js +55 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.js +0 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.js +0 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_DELETE.js +0 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.js +0 -0
- package/src/client/websocket/handlers/INTERACTION_CREATE.js +16 -0
- package/src/client/websocket/handlers/INTERACTION_FAILURE.js +18 -0
- package/src/client/websocket/handlers/INTERACTION_MODAL_CREATE.js +0 -1
- package/src/client/websocket/handlers/INTERACTION_SUCCESS.js +30 -0
- package/src/client/websocket/handlers/MESSAGE_ACK.js +16 -0
- package/src/client/websocket/handlers/READY.js +137 -47
- package/src/client/websocket/handlers/RELATIONSHIP_ADD.js +5 -7
- package/src/client/websocket/handlers/RELATIONSHIP_REMOVE.js +4 -6
- package/src/client/websocket/handlers/RELATIONSHIP_UPDATE.js +9 -32
- package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.js +0 -0
- package/src/client/websocket/handlers/USER_GUILD_SETTINGS_UPDATE.js +8 -2
- package/src/client/websocket/handlers/USER_NOTE_UPDATE.js +1 -1
- package/src/client/websocket/handlers/USER_SETTINGS_UPDATE.js +5 -1
- package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js +0 -0
- package/src/client/websocket/handlers/index.js +20 -15
- package/src/errors/Messages.js +69 -24
- package/src/index.js +43 -12
- package/src/managers/ApplicationCommandManager.js +12 -9
- package/src/managers/ApplicationCommandPermissionsManager.js +11 -3
- package/src/managers/ChannelManager.js +4 -2
- package/src/managers/ClientUserSettingManager.js +279 -161
- package/src/managers/DeveloperPortalManager.js +104 -0
- package/src/managers/GuildApplicationCommandManager.js +28 -0
- package/src/managers/GuildBanManager.js +1 -1
- package/src/managers/GuildChannelManager.js +0 -2
- package/src/managers/GuildFolderManager.js +24 -0
- package/src/managers/GuildForumThreadManager.js +28 -22
- package/src/managers/GuildMemberManager.js +216 -40
- package/src/managers/GuildSettingManager.js +15 -22
- package/src/managers/MessageManager.js +44 -42
- package/src/managers/PermissionOverwriteManager.js +1 -1
- package/src/managers/ReactionUserManager.js +5 -5
- package/src/managers/RelationshipManager.js +74 -81
- package/src/managers/SessionManager.js +57 -0
- package/src/managers/ThreadManager.js +45 -12
- package/src/managers/ThreadMemberManager.js +1 -1
- package/src/managers/UserManager.js +10 -6
- package/src/rest/APIRequest.js +20 -42
- package/src/rest/CaptchaSolver.js +132 -0
- package/src/rest/DiscordAPIError.js +16 -17
- package/src/rest/RESTManager.js +21 -1
- package/src/rest/RequestHandler.js +21 -35
- package/src/structures/ApplicationCommand.js +456 -19
- package/src/structures/ApplicationRoleConnectionMetadata.js +0 -3
- package/src/structures/AutoModerationRule.js +5 -5
- package/src/structures/AutocompleteInteraction.js +0 -1
- package/src/structures/BaseGuildTextChannel.js +12 -10
- package/src/structures/BaseGuildVoiceChannel.js +18 -16
- package/src/structures/{CallState.js → Call.js} +12 -17
- package/src/structures/CategoryChannel.js +0 -2
- package/src/structures/Channel.js +3 -2
- package/src/structures/ClientApplication.js +204 -0
- package/src/structures/ClientPresence.js +8 -12
- package/src/structures/ClientUser.js +336 -117
- package/src/structures/ContextMenuInteraction.js +1 -1
- package/src/structures/DMChannel.js +92 -29
- package/src/structures/DeveloperPortalApplication.js +520 -0
- package/src/structures/ForumChannel.js +10 -0
- package/src/structures/Guild.js +271 -135
- package/src/structures/GuildAuditLogs.js +5 -0
- package/src/structures/GuildChannel.js +2 -16
- package/src/structures/GuildFolder.js +75 -0
- package/src/structures/GuildMember.js +145 -27
- package/src/structures/Interaction.js +62 -1
- package/src/structures/InteractionResponse.js +114 -0
- package/src/structures/Invite.js +52 -35
- package/src/structures/Message.js +202 -222
- package/src/structures/MessageAttachment.js +0 -11
- package/src/structures/MessageButton.js +67 -1
- package/src/structures/MessageEmbed.js +1 -1
- package/src/structures/MessageMentions.js +2 -3
- package/src/structures/MessagePayload.js +46 -4
- package/src/structures/MessageReaction.js +1 -1
- package/src/structures/MessageSelectMenu.js +252 -1
- package/src/structures/Modal.js +180 -75
- package/src/structures/PartialGroupDMChannel.js +433 -0
- package/src/structures/Presence.js +2 -2
- package/src/structures/RichPresence.js +34 -14
- package/src/structures/Role.js +2 -18
- package/src/structures/SelectMenuInteraction.js +151 -2
- package/src/structures/Session.js +81 -0
- package/src/structures/Team.js +49 -0
- package/src/structures/TextInputComponent.js +70 -0
- package/src/structures/ThreadChannel.js +19 -0
- package/src/structures/User.js +345 -117
- package/src/structures/UserContextMenuInteraction.js +2 -2
- package/src/structures/VoiceState.js +39 -74
- package/src/structures/WebEmbed.js +52 -38
- package/src/structures/Webhook.js +11 -17
- package/src/structures/interfaces/Application.js +23 -146
- package/src/structures/interfaces/TextBasedChannel.js +256 -411
- package/src/util/ApplicationFlags.js +1 -1
- package/src/util/Constants.js +284 -106
- package/src/util/Formatters.js +2 -16
- package/src/util/LimitedCollection.js +1 -1
- package/src/util/Options.js +68 -48
- package/src/util/Permissions.js +0 -5
- package/src/util/PurchasedFlags.js +0 -2
- package/src/util/RemoteAuth.js +356 -221
- package/src/util/Sweepers.js +1 -1
- package/src/util/Util.js +36 -76
- package/src/util/Voice.js +1456 -0
- package/src/util/arRPC/index.js +229 -0
- package/src/util/arRPC/process/detectable.json +1 -0
- package/src/util/arRPC/process/index.js +102 -0
- package/src/util/arRPC/process/native/index.js +5 -0
- package/src/util/arRPC/process/native/linux.js +37 -0
- package/src/util/arRPC/process/native/win32.js +25 -0
- package/src/util/arRPC/transports/ipc.js +281 -0
- package/src/util/arRPC/transports/websocket.js +128 -0
- package/typings/enums.d.ts +73 -18
- package/typings/index.d.ts +1249 -897
- package/typings/rawDataTypes.d.ts +9 -68
- package/src/client/websocket/handlers/USER_REQUIRED_ACTION_UPDATE.js +0 -78
- package/src/client/websocket/handlers/VOICE_CHANNEL_STATUS_UPDATE.js +0 -12
- package/src/managers/UserNoteManager.js +0 -53
- package/src/structures/GroupDMChannel.js +0 -387
- package/src/util/AttachmentFlags.js +0 -38
- package/src/util/InviteFlags.js +0 -29
- package/src/util/RoleFlags.js +0 -37
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const { Collection } = require('@discordjs/collection');
|
|
3
4
|
const MessageComponentInteraction = require('./MessageComponentInteraction');
|
|
5
|
+
const { Events } = require('../util/Constants');
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
|
-
* Represents
|
|
8
|
+
* Represents any select menu interaction.
|
|
7
9
|
* @extends {MessageComponentInteraction}
|
|
8
10
|
*/
|
|
9
11
|
class SelectMenuInteraction extends MessageComponentInteraction {
|
|
@@ -18,4 +20,151 @@ class SelectMenuInteraction extends MessageComponentInteraction {
|
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
module.exports = SelectMenuInteraction;
|
|
23
|
+
module.exports.SelectMenuInteraction = SelectMenuInteraction;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Represents a CHANNEL_SELECT interaction.
|
|
27
|
+
* @extends {SelectMenuInteraction}
|
|
28
|
+
*/
|
|
29
|
+
class ChannelSelectInteraction extends SelectMenuInteraction {
|
|
30
|
+
constructor(client, data) {
|
|
31
|
+
super(client, data);
|
|
32
|
+
|
|
33
|
+
const { channels } = data.data.resolved ?? {};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Collection of the selected channels
|
|
37
|
+
* @type {Collection<Snowflake, Channel|APIChannel>}
|
|
38
|
+
*/
|
|
39
|
+
this.channels = new Collection();
|
|
40
|
+
for (const channel of Object.values(channels)) {
|
|
41
|
+
this.channel.set(channel.id, this.client.channels._add(channel));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports.ChannelSelectInteraction = ChannelSelectInteraction;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Represents a ROLE_SELECT interaction.
|
|
50
|
+
* @extends {SelectMenuInteraction}
|
|
51
|
+
*/
|
|
52
|
+
class RoleSelectInteraction extends SelectMenuInteraction {
|
|
53
|
+
constructor(client, data) {
|
|
54
|
+
super(client, data);
|
|
55
|
+
|
|
56
|
+
const { roles } = data.data.resolved ?? {};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Collection of the selected roles
|
|
60
|
+
* @type {Collection<Snowflake, Role|APIRole>}
|
|
61
|
+
*/
|
|
62
|
+
this.roles = new Collection();
|
|
63
|
+
for (const role of Object.values(roles)) {
|
|
64
|
+
this.roles.set(role.id, this.guild?.roles._add(role) ?? role);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
module.exports.RoleSelectInteraction = RoleSelectInteraction;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Represents a USER_SELECT interaction.
|
|
73
|
+
* @extends {SelectMenuInteraction}
|
|
74
|
+
*/
|
|
75
|
+
class UserSelectInteraction extends SelectMenuInteraction {
|
|
76
|
+
constructor(client, data) {
|
|
77
|
+
super(client, data);
|
|
78
|
+
|
|
79
|
+
const { members, users } = data.data.resolved ?? {};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Collection of the selected users
|
|
83
|
+
* @type {Collection<Snowflake, User>}
|
|
84
|
+
*/
|
|
85
|
+
this.users = new Collection();
|
|
86
|
+
for (const user of Object.values(users)) {
|
|
87
|
+
this.users.set(user.id, this.client.users._add(user));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (members) {
|
|
91
|
+
/**
|
|
92
|
+
* Collection of the selected members
|
|
93
|
+
* @type {Collection<Snowflake, GuildMember|APIGuildMember>}
|
|
94
|
+
*/
|
|
95
|
+
this.members = new Collection();
|
|
96
|
+
for (const [id, member] of Object.entries(members)) {
|
|
97
|
+
const user = users[id];
|
|
98
|
+
if (!user) {
|
|
99
|
+
this.client.emit(Events.DEBUG, `[SelectMenuInteraction] Received a member without a user, skipping ${id}`);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
this.members.set(id, this.guild?.members._add({ user, ...member }) ?? { user, ...member });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
module.exports.UserSelectInteraction = UserSelectInteraction;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Represents a MENTIONABLE_SELECT interaction.
|
|
112
|
+
* @extends {SelectMenuInteraction}
|
|
113
|
+
*/
|
|
114
|
+
class MentionableSelectInteraction extends SelectMenuInteraction {
|
|
115
|
+
constructor(client, data) {
|
|
116
|
+
super(client, data);
|
|
117
|
+
|
|
118
|
+
const { members, users, roles, channels } = data.data.resolved ?? {};
|
|
119
|
+
|
|
120
|
+
if (channels) {
|
|
121
|
+
/**
|
|
122
|
+
* Collection of the selected channels
|
|
123
|
+
* @type {Collection<Snowflake, Channel|APIChannel>}
|
|
124
|
+
*/
|
|
125
|
+
this.channels = new Collection();
|
|
126
|
+
for (const channel of Object.values(channels)) {
|
|
127
|
+
this.channels.set(channel.id, this.client?.channels._add(channel) ?? channel);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (members) {
|
|
132
|
+
/**
|
|
133
|
+
* Collection of the selected members
|
|
134
|
+
* @type {Collection<Snowflake, GuildMember|APIGuildMember>}
|
|
135
|
+
*/
|
|
136
|
+
this.members = new Collection();
|
|
137
|
+
for (const [id, member] of Object.entries(members)) {
|
|
138
|
+
const user = users[id];
|
|
139
|
+
if (!user) {
|
|
140
|
+
this.client.emit(Events.DEBUG, `[SelectMenuInteraction] Received a member without a user, skipping ${id}`);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
this.members.set(id, this.guild?.members._add({ user, ...member }) ?? { user, ...member });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (roles) {
|
|
148
|
+
/**
|
|
149
|
+
* Collection of the selected roles
|
|
150
|
+
* @type {Collection<Snowflake, Role|APIRole>}
|
|
151
|
+
*/
|
|
152
|
+
this.roles = new Collection();
|
|
153
|
+
for (const role of Object.values(roles)) {
|
|
154
|
+
this.roles.set(role.id, this.guild?.roles._add(role) ?? role);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (users) {
|
|
159
|
+
/**
|
|
160
|
+
* Collection of the selected users
|
|
161
|
+
* @type {Collection<Snowflake, User>}
|
|
162
|
+
*/
|
|
163
|
+
this.users = new Collection();
|
|
164
|
+
for (const user of Object.values(users)) {
|
|
165
|
+
this.users.set(user.id, this.client.users._add(user));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
module.exports.MentionableSelectInteraction = MentionableSelectInteraction;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const Base = require('./Base');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {Object} SessionClientInfo
|
|
7
|
+
* @property {string} location Location of the client (using IP address)
|
|
8
|
+
* @property {string} platform Platform of the client
|
|
9
|
+
* @property {string} os Operating system of the client
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Represents a Client OAuth2 Application Team.
|
|
14
|
+
* @extends {Base}
|
|
15
|
+
*/
|
|
16
|
+
class Session extends Base {
|
|
17
|
+
constructor(client, data) {
|
|
18
|
+
super(client);
|
|
19
|
+
this._patch(data);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_patch(data) {
|
|
23
|
+
if ('id_hash' in data) {
|
|
24
|
+
/**
|
|
25
|
+
* The session hash id
|
|
26
|
+
* @type {string}
|
|
27
|
+
*/
|
|
28
|
+
this.id = data.id_hash;
|
|
29
|
+
}
|
|
30
|
+
if ('approx_last_used_time' in data) {
|
|
31
|
+
this.approxLastUsedTime = data.approx_last_used_time;
|
|
32
|
+
}
|
|
33
|
+
if ('client_info' in data) {
|
|
34
|
+
/**
|
|
35
|
+
* The client info
|
|
36
|
+
* @type {SessionClientInfo}
|
|
37
|
+
*/
|
|
38
|
+
this.clientInfo = data.client_info;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The timestamp the client was last used at.
|
|
44
|
+
* @type {number}
|
|
45
|
+
* @readonly
|
|
46
|
+
*/
|
|
47
|
+
get createdTimestamp() {
|
|
48
|
+
return this.createdAt.getTime();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The time the client was last used at.
|
|
53
|
+
* @type {Date}
|
|
54
|
+
* @readonly
|
|
55
|
+
*/
|
|
56
|
+
get createdAt() {
|
|
57
|
+
return new Date(this.approxLastUsedTime);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Logout the client (remote).
|
|
62
|
+
* @param {string | null} mfaCode MFA code (if 2FA is enabled)
|
|
63
|
+
* @returns {Promise<undefined>}
|
|
64
|
+
*/
|
|
65
|
+
logout(mfaCode) {
|
|
66
|
+
if (typeof this.client.password !== 'string') throw new Error('REQUIRE_PASSWORD', 'You must provide a password.');
|
|
67
|
+
return this.client.api.auth.sessions.logout({
|
|
68
|
+
data: {
|
|
69
|
+
session_id_hashes: [this.id],
|
|
70
|
+
password: this.client.password,
|
|
71
|
+
code: typeof mfaCode === 'string' ? mfaCode : undefined,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
toJSON() {
|
|
77
|
+
return super.toJSON();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
module.exports = Session;
|
package/src/structures/Team.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
const { Collection } = require('@discordjs/collection');
|
|
4
4
|
const Base = require('./Base');
|
|
5
5
|
const TeamMember = require('./TeamMember');
|
|
6
|
+
const User = require('./User');
|
|
7
|
+
const { Error } = require('../errors');
|
|
6
8
|
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
|
7
9
|
|
|
8
10
|
/**
|
|
@@ -98,6 +100,53 @@ class Team extends Base {
|
|
|
98
100
|
return this.client.rest.cdn.TeamIcon(this.id, this.icon, { format, size });
|
|
99
101
|
}
|
|
100
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Invite a team member to the team
|
|
105
|
+
* @param {User} user The user to invite to the team
|
|
106
|
+
* @param {number} MFACode The mfa code
|
|
107
|
+
* @returns {Promise<TeamMember>}
|
|
108
|
+
*/
|
|
109
|
+
async inviteMember(user, MFACode) {
|
|
110
|
+
if (!(user instanceof User)) return new Error('TEAM_MEMBER_FORMAT');
|
|
111
|
+
const regex = /([0-9]{6})/g;
|
|
112
|
+
|
|
113
|
+
const payload = {
|
|
114
|
+
username: user.username,
|
|
115
|
+
discriminator: user.discriminator,
|
|
116
|
+
};
|
|
117
|
+
if (MFACode && !regex.test(MFACode)) return new Error('MFA_INVALID');
|
|
118
|
+
if (MFACode) payload.code = MFACode;
|
|
119
|
+
|
|
120
|
+
const member = await this.client.api.teams(this.id).members.post({
|
|
121
|
+
data: payload,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
this.members.set(member.user.id, new TeamMember(this, member));
|
|
125
|
+
return this.members.get(member.user.id);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Remove a member from the team
|
|
130
|
+
* @param {Snowflake} userID The ID of the user you want to remove
|
|
131
|
+
* @returns {boolean}
|
|
132
|
+
*/
|
|
133
|
+
async removeMember(userID) {
|
|
134
|
+
await this.client.api.teams[this.id].members[userID].delete();
|
|
135
|
+
return this.members.delete(userID);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Delete this team
|
|
140
|
+
* @param {number} MFACode The 2fa code
|
|
141
|
+
* @returns {Promise<boolean>}
|
|
142
|
+
*/
|
|
143
|
+
async delete(MFACode) {
|
|
144
|
+
const regex = /([0-9]{6})/g;
|
|
145
|
+
if (!regex.test(MFACode)) return new Error('MFA_INVALID');
|
|
146
|
+
await this.client.api.teams[this.id].delete({ data: { code: MFACode } });
|
|
147
|
+
return this.client.developerPortal.teams.delete(this.id);
|
|
148
|
+
}
|
|
149
|
+
|
|
101
150
|
/**
|
|
102
151
|
* When concatenated with a string, this automatically returns the Team's name instead of the
|
|
103
152
|
* Team object.
|
|
@@ -82,6 +82,76 @@ class TextInputComponent extends BaseMessageComponent {
|
|
|
82
82
|
this.value = data.value ?? null;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Sets the custom id of this text input component
|
|
87
|
+
* @param {string} customId A unique string to be sent in the interaction when submitted
|
|
88
|
+
* @returns {TextInputComponent}
|
|
89
|
+
*/
|
|
90
|
+
setCustomId(customId) {
|
|
91
|
+
this.customId = Util.verifyString(customId, RangeError, 'TEXT_INPUT_CUSTOM_ID');
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Sets the label of this text input component
|
|
97
|
+
* @param {string} label The text to be displayed above this text input component
|
|
98
|
+
* @returns {TextInputComponent}
|
|
99
|
+
*/
|
|
100
|
+
setLabel(label) {
|
|
101
|
+
this.label = Util.verifyString(label, RangeError, 'TEXT_INPUT_LABEL');
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Sets the text input component to be required for modal submission
|
|
107
|
+
* @param {boolean} [required=true] Whether this text input component is required
|
|
108
|
+
* @returns {TextInputComponent}
|
|
109
|
+
*/
|
|
110
|
+
setRequired(required = true) {
|
|
111
|
+
this.required = required;
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Sets the maximum length of text input required in this text input component
|
|
117
|
+
* @param {number} maxLength Maximum length of text to be required
|
|
118
|
+
* @returns {TextInputComponent}
|
|
119
|
+
*/
|
|
120
|
+
setMaxLength(maxLength) {
|
|
121
|
+
this.maxLength = maxLength;
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Sets the minimum length of text input required in this text input component
|
|
127
|
+
* @param {number} minLength Minimum length of text to be required
|
|
128
|
+
* @returns {TextInputComponent}
|
|
129
|
+
*/
|
|
130
|
+
setMinLength(minLength) {
|
|
131
|
+
this.minLength = minLength;
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Sets the placeholder of this text input component
|
|
137
|
+
* @param {string} placeholder Custom placeholder text to display when no text is entered
|
|
138
|
+
* @returns {TextInputComponent}
|
|
139
|
+
*/
|
|
140
|
+
setPlaceholder(placeholder) {
|
|
141
|
+
this.placeholder = Util.verifyString(placeholder, RangeError, 'TEXT_INPUT_PLACEHOLDER');
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Sets the style of this text input component
|
|
147
|
+
* @param {TextInputStyleResolvable} style The style of this text input component
|
|
148
|
+
* @returns {TextInputComponent}
|
|
149
|
+
*/
|
|
150
|
+
setStyle(style) {
|
|
151
|
+
this.style = TextInputComponent.resolveStyle(style);
|
|
152
|
+
return this;
|
|
153
|
+
}
|
|
154
|
+
|
|
85
155
|
/**
|
|
86
156
|
* Sets the value of this text input component
|
|
87
157
|
* @param {string} value Value of this text input component
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const { Channel } = require('./Channel');
|
|
4
4
|
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
|
5
5
|
const { RangeError } = require('../errors');
|
|
6
|
+
const InteractionManager = require('../managers/InteractionManager');
|
|
6
7
|
const MessageManager = require('../managers/MessageManager');
|
|
7
8
|
const ThreadMemberManager = require('../managers/ThreadMemberManager');
|
|
8
9
|
const ChannelFlags = require('../util/ChannelFlags');
|
|
@@ -41,9 +42,24 @@ class ThreadChannel extends Channel {
|
|
|
41
42
|
* @type {ThreadMemberManager}
|
|
42
43
|
*/
|
|
43
44
|
this.members = new ThreadMemberManager(this);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A manager of the interactions sent to this channel
|
|
48
|
+
* @type {InteractionManager}
|
|
49
|
+
*/
|
|
50
|
+
this.interactions = new InteractionManager(this);
|
|
44
51
|
if (data) this._patch(data);
|
|
45
52
|
}
|
|
46
53
|
|
|
54
|
+
/**
|
|
55
|
+
* First message in the thread
|
|
56
|
+
* @type {?Message}
|
|
57
|
+
* @readonly
|
|
58
|
+
*/
|
|
59
|
+
get firstMessage() {
|
|
60
|
+
return this.messages.cache.get(this.id);
|
|
61
|
+
}
|
|
62
|
+
|
|
47
63
|
_patch(data, partial = false) {
|
|
48
64
|
super._patch(data);
|
|
49
65
|
|
|
@@ -598,6 +614,9 @@ class ThreadChannel extends Channel {
|
|
|
598
614
|
sendTyping() {}
|
|
599
615
|
createMessageCollector() {}
|
|
600
616
|
awaitMessages() {}
|
|
617
|
+
createMessageComponentCollector() {}
|
|
618
|
+
awaitMessageComponent() {}
|
|
619
|
+
bulkDelete() {}
|
|
601
620
|
// Doesn't work on Thread channels; setRateLimitPerUser() {}
|
|
602
621
|
// Doesn't work on Thread channels; setNSFW() {}
|
|
603
622
|
}
|