djs-selfbot-v13 3.1.7 → 3.1.8
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/LICENSE +1 -1
- package/README.md +18 -45
- package/package.json +8 -37
- package/src/client/BaseClient.js +2 -3
- package/src/client/Client.js +187 -539
- package/src/client/actions/Action.js +18 -13
- package/src/client/actions/ActionsManager.js +7 -1
- package/src/client/actions/AutoModerationActionExecution.js +1 -0
- package/src/client/actions/AutoModerationRuleCreate.js +1 -0
- package/src/client/actions/AutoModerationRuleDelete.js +1 -0
- package/src/client/actions/AutoModerationRuleUpdate.js +1 -0
- package/src/client/actions/MessageCreate.js +0 -4
- package/src/client/actions/PresenceUpdate.js +17 -16
- package/src/client/websocket/WebSocketManager.js +11 -31
- package/src/client/websocket/WebSocketShard.js +39 -38
- 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 +16 -13
- package/src/client/websocket/handlers/CHANNEL_RECIPIENT_REMOVE.js +11 -11
- package/src/client/websocket/handlers/GUILD_CREATE.js +7 -0
- package/src/client/websocket/handlers/INTERACTION_MODAL_CREATE.js +1 -0
- package/src/client/websocket/handlers/READY.js +47 -137
- package/src/client/websocket/handlers/RELATIONSHIP_ADD.js +7 -5
- package/src/client/websocket/handlers/RELATIONSHIP_REMOVE.js +6 -4
- package/src/client/websocket/handlers/RELATIONSHIP_UPDATE.js +32 -9
- package/src/client/websocket/handlers/USER_GUILD_SETTINGS_UPDATE.js +2 -8
- package/src/client/websocket/handlers/USER_NOTE_UPDATE.js +1 -1
- package/src/client/websocket/handlers/USER_REQUIRED_ACTION_UPDATE.js +78 -0
- package/src/client/websocket/handlers/USER_SETTINGS_UPDATE.js +1 -5
- package/src/client/websocket/handlers/VOICE_CHANNEL_STATUS_UPDATE.js +12 -0
- package/src/client/websocket/handlers/index.js +15 -20
- package/src/errors/Messages.js +24 -69
- package/src/index.js +12 -43
- package/src/managers/ApplicationCommandManager.js +9 -12
- package/src/managers/ApplicationCommandPermissionsManager.js +3 -11
- package/src/managers/ChannelManager.js +3 -4
- package/src/managers/ClientUserSettingManager.js +161 -279
- package/src/managers/GuildBanManager.js +1 -1
- package/src/managers/GuildChannelManager.js +2 -0
- package/src/managers/GuildForumThreadManager.js +22 -28
- package/src/managers/GuildMemberManager.js +40 -216
- package/src/managers/GuildSettingManager.js +22 -15
- package/src/managers/MessageManager.js +42 -44
- package/src/managers/PermissionOverwriteManager.js +1 -1
- package/src/managers/ReactionUserManager.js +5 -5
- package/src/managers/RelationshipManager.js +81 -74
- package/src/managers/ThreadManager.js +12 -45
- package/src/managers/ThreadMemberManager.js +1 -1
- package/src/managers/UserManager.js +6 -10
- package/src/managers/UserNoteManager.js +53 -0
- package/src/rest/APIRequest.js +42 -20
- package/src/rest/DiscordAPIError.js +17 -16
- package/src/rest/RESTManager.js +1 -21
- package/src/rest/RequestHandler.js +35 -21
- package/src/structures/ApplicationCommand.js +19 -456
- package/src/structures/ApplicationRoleConnectionMetadata.js +3 -0
- package/src/structures/AutoModerationRule.js +5 -5
- package/src/structures/AutocompleteInteraction.js +1 -0
- package/src/structures/BaseGuildTextChannel.js +10 -12
- package/src/structures/BaseGuildVoiceChannel.js +16 -18
- package/src/structures/{Call.js → CallState.js} +17 -12
- package/src/structures/CategoryChannel.js +2 -0
- package/src/structures/Channel.js +2 -3
- package/src/structures/ClientPresence.js +12 -8
- package/src/structures/ClientUser.js +117 -336
- package/src/structures/ContextMenuInteraction.js +1 -1
- package/src/structures/DMChannel.js +29 -92
- package/src/structures/ForumChannel.js +0 -10
- package/src/structures/GroupDMChannel.js +387 -0
- package/src/structures/Guild.js +135 -271
- package/src/structures/GuildAuditLogs.js +0 -5
- package/src/structures/GuildChannel.js +16 -2
- package/src/structures/GuildMember.js +27 -145
- package/src/structures/Interaction.js +1 -62
- package/src/structures/Invite.js +35 -52
- package/src/structures/Message.js +228 -202
- package/src/structures/MessageAttachment.js +11 -0
- package/src/structures/MessageButton.js +1 -67
- package/src/structures/MessageEmbed.js +1 -1
- package/src/structures/MessageMentions.js +3 -2
- package/src/structures/MessagePayload.js +4 -46
- package/src/structures/MessageReaction.js +1 -1
- package/src/structures/MessageSelectMenu.js +1 -252
- package/src/structures/Modal.js +75 -180
- package/src/structures/Presence.js +2 -2
- package/src/structures/RichPresence.js +14 -34
- package/src/structures/Role.js +18 -2
- package/src/structures/SelectMenuInteraction.js +2 -151
- package/src/structures/Team.js +0 -49
- package/src/structures/TextInputComponent.js +0 -70
- package/src/structures/ThreadChannel.js +0 -19
- package/src/structures/User.js +117 -345
- package/src/structures/UserContextMenuInteraction.js +2 -2
- package/src/structures/VoiceState.js +74 -39
- package/src/structures/WebEmbed.js +38 -52
- package/src/structures/Webhook.js +17 -11
- package/src/structures/interfaces/Application.js +146 -23
- package/src/structures/interfaces/TextBasedChannel.js +411 -256
- package/src/util/ApplicationFlags.js +1 -1
- package/src/util/AttachmentFlags.js +38 -0
- package/src/util/Constants.js +106 -284
- package/src/util/Formatters.js +16 -2
- package/src/util/InviteFlags.js +29 -0
- package/src/util/LimitedCollection.js +1 -1
- package/src/util/Options.js +48 -68
- package/src/util/Permissions.js +5 -0
- package/src/util/PurchasedFlags.js +2 -0
- package/src/util/RemoteAuth.js +221 -356
- package/src/util/RoleFlags.js +37 -0
- package/src/util/Sweepers.js +1 -1
- package/src/util/Util.js +76 -36
- package/typings/enums.d.ts +18 -73
- package/typings/index.d.ts +873 -1225
- package/typings/rawDataTypes.d.ts +68 -9
- package/src/client/actions/InteractionCreate.js +0 -115
- package/src/client/websocket/handlers/APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE.js +0 -23
- package/src/client/websocket/handlers/GUILD_APPLICATION_COMMANDS_UPDATE.js +0 -11
- package/src/client/websocket/handlers/GUILD_MEMBER_LIST_UPDATE.js +0 -55
- 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 +0 -16
- package/src/client/websocket/handlers/INTERACTION_FAILURE.js +0 -18
- package/src/client/websocket/handlers/INTERACTION_SUCCESS.js +0 -30
- package/src/client/websocket/handlers/MESSAGE_ACK.js +0 -16
- package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.js +0 -0
- package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js +0 -0
- package/src/managers/DeveloperPortalManager.js +0 -104
- package/src/managers/GuildApplicationCommandManager.js +0 -28
- package/src/managers/GuildFolderManager.js +0 -24
- package/src/managers/SessionManager.js +0 -57
- package/src/rest/CaptchaSolver.js +0 -132
- package/src/structures/ClientApplication.js +0 -204
- package/src/structures/DeveloperPortalApplication.js +0 -520
- package/src/structures/GuildFolder.js +0 -75
- package/src/structures/InteractionResponse.js +0 -114
- package/src/structures/PartialGroupDMChannel.js +0 -433
- package/src/structures/Session.js +0 -81
- package/src/util/Voice.js +0 -1456
- package/src/util/arRPC/index.js +0 -229
- package/src/util/arRPC/process/detectable.json +0 -1
- package/src/util/arRPC/process/index.js +0 -102
- package/src/util/arRPC/process/native/index.js +0 -5
- package/src/util/arRPC/process/native/linux.js +0 -37
- package/src/util/arRPC/process/native/win32.js +0 -25
- package/src/util/arRPC/transports/ipc.js +0 -281
- package/src/util/arRPC/transports/websocket.js +0 -128
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
const { setInterval } = require('node:timers');
|
|
4
4
|
const { Collection } = require('@discordjs/collection');
|
|
5
5
|
const Invite = require('./Invite');
|
|
6
|
-
const { Message } = require('./Message');
|
|
7
6
|
const User = require('./User');
|
|
8
|
-
const { Util } = require('..');
|
|
9
|
-
const { Error: Error_ } = require('../errors');
|
|
10
|
-
const { Opcodes, NitroType, HypeSquadType } = require('../util/Constants');
|
|
11
7
|
const DataResolver = require('../util/DataResolver');
|
|
12
8
|
const PremiumUsageFlags = require('../util/PremiumUsageFlags');
|
|
13
9
|
const PurchasedFlags = require('../util/PurchasedFlags');
|
|
10
|
+
const Util = require('../util/Util');
|
|
11
|
+
|
|
14
12
|
/**
|
|
15
13
|
* Represents the logged in client's Discord user.
|
|
16
14
|
* @extends {User}
|
|
@@ -36,7 +34,7 @@ class ClientUser extends User {
|
|
|
36
34
|
|
|
37
35
|
if ('mfa_enabled' in data) {
|
|
38
36
|
/**
|
|
39
|
-
* If the bot's {@link
|
|
37
|
+
* If the bot's {@link Application#owner Owner} has MFA enabled on their account
|
|
40
38
|
* @type {?boolean}
|
|
41
39
|
*/
|
|
42
40
|
this.mfaEnabled = typeof data.mfa_enabled === 'boolean' ? data.mfa_enabled : null;
|
|
@@ -46,30 +44,24 @@ class ClientUser extends User {
|
|
|
46
44
|
|
|
47
45
|
if ('token' in data) this.client.token = data.token;
|
|
48
46
|
|
|
49
|
-
// Todo: Add (Selfbot)
|
|
50
|
-
if ('premium_type' in data) {
|
|
51
|
-
const nitro = NitroType[data.premium_type ?? 0];
|
|
52
|
-
/**
|
|
53
|
-
* Nitro type of the client user.
|
|
54
|
-
* @type {NitroType}
|
|
55
|
-
*/
|
|
56
|
-
this.nitroType = nitro ?? `UNKNOWN_TYPE_${data.premium_type}`;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
47
|
if ('purchased_flags' in data) {
|
|
60
48
|
/**
|
|
61
49
|
* Purchased state of the client user.
|
|
62
|
-
* @type {
|
|
50
|
+
* @type {Readonly<PurchasedFlags>}
|
|
63
51
|
*/
|
|
64
|
-
this.purchasedFlags = new PurchasedFlags(data.purchased_flags || 0);
|
|
52
|
+
this.purchasedFlags = new PurchasedFlags(data.purchased_flags || 0).freeze();
|
|
53
|
+
} else {
|
|
54
|
+
this.purchasedFlags = new PurchasedFlags().freeze();
|
|
65
55
|
}
|
|
66
56
|
|
|
67
57
|
if ('premium_usage_flags' in data) {
|
|
68
58
|
/**
|
|
69
59
|
* Premium usage state of the client user.
|
|
70
|
-
* @type {
|
|
60
|
+
* @type {Readonly<PremiumUsageFlags>}
|
|
71
61
|
*/
|
|
72
62
|
this.premiumUsageFlags = new PremiumUsageFlags(data.premium_usage_flags || 0);
|
|
63
|
+
} else {
|
|
64
|
+
this.premiumUsageFlags = new PremiumUsageFlags().freeze();
|
|
73
65
|
}
|
|
74
66
|
|
|
75
67
|
if ('phone' in data) {
|
|
@@ -77,7 +69,7 @@ class ClientUser extends User {
|
|
|
77
69
|
* Phone number of the client user.
|
|
78
70
|
* @type {?string}
|
|
79
71
|
*/
|
|
80
|
-
this.
|
|
72
|
+
this.phone = data.phone;
|
|
81
73
|
}
|
|
82
74
|
|
|
83
75
|
if ('nsfw_allowed' in data) {
|
|
@@ -93,50 +85,37 @@ class ClientUser extends User {
|
|
|
93
85
|
* Email address of the client user.
|
|
94
86
|
* @type {?string}
|
|
95
87
|
*/
|
|
96
|
-
this.
|
|
88
|
+
this.email = data.email;
|
|
97
89
|
}
|
|
98
90
|
|
|
99
91
|
if ('bio' in data) {
|
|
92
|
+
/**
|
|
93
|
+
* About me (User)
|
|
94
|
+
* <info>The user must be force fetched for this property to be present or be updated</info>
|
|
95
|
+
* @type {?string}
|
|
96
|
+
*/
|
|
100
97
|
this.bio = data.bio;
|
|
101
98
|
}
|
|
102
99
|
|
|
103
100
|
if ('pronouns' in data) {
|
|
101
|
+
/**
|
|
102
|
+
* Pronouns (User)
|
|
103
|
+
* <info>The user must be force fetched for this property to be present or be updated</info>
|
|
104
|
+
* @type {?string}
|
|
105
|
+
*/
|
|
104
106
|
this.pronouns = data.pronouns;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
if (
|
|
109
|
+
if ('premium_type' in data) {
|
|
108
110
|
/**
|
|
109
|
-
*
|
|
110
|
-
* @type {
|
|
111
|
-
* @
|
|
111
|
+
* Premium types denote the level of premium a user has.
|
|
112
|
+
* @type {number}
|
|
113
|
+
* @see {@link https://discord-userdoccers.vercel.app/resources/user#premium-type}
|
|
112
114
|
*/
|
|
113
|
-
this.
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (!this._intervalSamsungPresence) {
|
|
117
|
-
this._intervalSamsungPresence = setInterval(() => {
|
|
118
|
-
this.client.emit('debug', `Samsung Presence: ${this._packageName}`);
|
|
119
|
-
if (!this._packageName) return;
|
|
120
|
-
this.setSamsungActivity(this._packageName, 'UPDATE');
|
|
121
|
-
}, 1000 * 60 * 10).unref();
|
|
122
|
-
// 20 minutes max
|
|
115
|
+
this.premiumType = data.premium_type;
|
|
123
116
|
}
|
|
124
117
|
}
|
|
125
118
|
|
|
126
|
-
/**
|
|
127
|
-
* Patch note
|
|
128
|
-
* @param {Object} data Note data
|
|
129
|
-
* @private
|
|
130
|
-
*/
|
|
131
|
-
_patchNote(data) {
|
|
132
|
-
/**
|
|
133
|
-
* The notes cache of the client user.
|
|
134
|
-
* @type {Collection<Snowflake, string>}
|
|
135
|
-
* @private
|
|
136
|
-
*/
|
|
137
|
-
this.notes = data ? new Collection(Object.entries(data)) : new Collection();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
119
|
/**
|
|
141
120
|
* Represents the client user's presence
|
|
142
121
|
* @type {ClientPresence}
|
|
@@ -172,22 +151,16 @@ class ClientUser extends User {
|
|
|
172
151
|
* <info>Changing usernames in Discord is heavily rate limited, with only 2 requests
|
|
173
152
|
* every hour. Use this sparingly!</info>
|
|
174
153
|
* @param {string} username The new username
|
|
175
|
-
* @param {string} password
|
|
154
|
+
* @param {string} password Current Password
|
|
176
155
|
* @returns {Promise<ClientUser>}
|
|
177
156
|
* @example
|
|
178
157
|
* // Set username
|
|
179
|
-
* client.user.setUsername('discordjs')
|
|
158
|
+
* client.user.setUsername('discordjs', 'passw@rd')
|
|
180
159
|
* .then(user => console.log(`My new username is ${user.username}`))
|
|
181
160
|
* .catch(console.error);
|
|
182
161
|
*/
|
|
183
162
|
setUsername(username, password) {
|
|
184
|
-
|
|
185
|
-
throw new Error('A password is required to change a username.');
|
|
186
|
-
}
|
|
187
|
-
return this.edit({
|
|
188
|
-
username,
|
|
189
|
-
password: this.client.password ? this.client.password : password,
|
|
190
|
-
});
|
|
163
|
+
return this.edit({ username, password });
|
|
191
164
|
}
|
|
192
165
|
|
|
193
166
|
/**
|
|
@@ -204,191 +177,12 @@ class ClientUser extends User {
|
|
|
204
177
|
avatar = avatar && (await DataResolver.resolveImage(avatar));
|
|
205
178
|
return this.edit({ avatar });
|
|
206
179
|
}
|
|
207
|
-
/**
|
|
208
|
-
* Sets the banner of the logged in client.
|
|
209
|
-
* @param {?(BufferResolvable|Base64Resolvable)} banner The new banner
|
|
210
|
-
* @returns {Promise<ClientUser>}
|
|
211
|
-
* @example
|
|
212
|
-
* // Set banner
|
|
213
|
-
* client.user.setBanner('./banner.png')
|
|
214
|
-
* .then(user => console.log(`New banner set!`))
|
|
215
|
-
* .catch(console.error);
|
|
216
|
-
*/
|
|
217
|
-
async setBanner(banner) {
|
|
218
|
-
if (this.nitroType !== 'NITRO_BOOST') {
|
|
219
|
-
throw new Error('You must be a Nitro Boosted User to change your banner.');
|
|
220
|
-
}
|
|
221
|
-
banner = banner && (await DataResolver.resolveImage(banner));
|
|
222
|
-
return this.edit({ banner });
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Set HyperSquad House
|
|
227
|
-
* @param {HypeSquadType} type
|
|
228
|
-
* * `LEAVE`: 0
|
|
229
|
-
* * `HOUSE_BRAVERY`: 1
|
|
230
|
-
* * `HOUSE_BRILLIANCE`: 2
|
|
231
|
-
* * `HOUSE_BALANCE`: 3
|
|
232
|
-
* @returns {Promise<void>}
|
|
233
|
-
* @example
|
|
234
|
-
* // Set HyperSquad HOUSE_BRAVERY
|
|
235
|
-
* client.user.setHypeSquad(1); || client.user.setHypeSquad('HOUSE_BRAVERY');
|
|
236
|
-
* // Leave
|
|
237
|
-
* client.user.setHypeSquad(0);
|
|
238
|
-
*/
|
|
239
|
-
async setHypeSquad(type) {
|
|
240
|
-
const id = typeof type === 'string' ? HypeSquadType[type] : type;
|
|
241
|
-
if (!id && id !== 0) throw new Error('Invalid HypeSquad type.');
|
|
242
|
-
if (id !== 0) {
|
|
243
|
-
const data = await this.client.api.hypesquad.online.post({
|
|
244
|
-
data: { house_id: id },
|
|
245
|
-
});
|
|
246
|
-
return data;
|
|
247
|
-
} else {
|
|
248
|
-
const data = await this.client.api.hypesquad.online.delete();
|
|
249
|
-
return data;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Set Accent color
|
|
255
|
-
* @param {ColorResolvable} color Color to set
|
|
256
|
-
* @returns {Promise<ClientUser>}
|
|
257
|
-
*/
|
|
258
|
-
setAccentColor(color = null) {
|
|
259
|
-
return this.edit({ accent_color: color ? Util.resolveColor(color) : null });
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Set discriminator
|
|
264
|
-
* @param {User.discriminator} discriminator It is #1234
|
|
265
|
-
* @param {string} password The password of the account
|
|
266
|
-
* @returns {Promise<ClientUser>}
|
|
267
|
-
*/
|
|
268
|
-
setDiscriminator(discriminator, password) {
|
|
269
|
-
if (this.nitroType == 'NONE') throw new Error('You must be a Nitro User to change your discriminator.');
|
|
270
|
-
if (!password && !this.client.password) {
|
|
271
|
-
throw new Error('A password is required to change a discriminator.');
|
|
272
|
-
}
|
|
273
|
-
return this.edit({
|
|
274
|
-
discriminator,
|
|
275
|
-
username: this.username,
|
|
276
|
-
password: this.client.password ? this.client.password : password,
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Set About me
|
|
282
|
-
* @param {string | null} bio Bio to set
|
|
283
|
-
* @returns {Promise<ClientUser>}
|
|
284
|
-
*/
|
|
285
|
-
setAboutMe(bio = null) {
|
|
286
|
-
return this.edit({
|
|
287
|
-
bio,
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Change the email
|
|
293
|
-
* @param {Email<string>} email Email to change
|
|
294
|
-
* @param {string} password Password of the account
|
|
295
|
-
* @returns {Promise<ClientUser>}
|
|
296
|
-
*/
|
|
297
|
-
setEmail(email, password) {
|
|
298
|
-
throw new Error('This method is not available yet. Please use the official Discord client to change your email.');
|
|
299
|
-
// eslint-disable-next-line no-unreachable
|
|
300
|
-
if (!password && !this.client.password) {
|
|
301
|
-
throw new Error('A password is required to change a email.');
|
|
302
|
-
}
|
|
303
|
-
return this.edit({
|
|
304
|
-
email,
|
|
305
|
-
password: this.client.password ? this.client.password : password,
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Set new password
|
|
311
|
-
* @param {string} oldPassword Old password
|
|
312
|
-
* @param {string} newPassword New password to set
|
|
313
|
-
* @returns {Promise<ClientUser>}
|
|
314
|
-
*/
|
|
315
|
-
setPassword(oldPassword, newPassword) {
|
|
316
|
-
if (!oldPassword && !this.client.password) {
|
|
317
|
-
throw new Error('A password is required to change a password.');
|
|
318
|
-
}
|
|
319
|
-
if (!newPassword) throw new Error('New password is required.');
|
|
320
|
-
return this.edit({
|
|
321
|
-
password: this.client.password ? this.client.password : oldPassword,
|
|
322
|
-
new_password: newPassword,
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Disable account
|
|
328
|
-
* @param {string} password Password of the account
|
|
329
|
-
* @returns {Promise<ClientUser>}
|
|
330
|
-
*/
|
|
331
|
-
async disableAccount(password) {
|
|
332
|
-
if (!password && !this.client.password) {
|
|
333
|
-
throw new Error('A password is required to disable an account.');
|
|
334
|
-
}
|
|
335
|
-
const data = await this.client.api.users['@me'].disable.post({
|
|
336
|
-
data: {
|
|
337
|
-
password: this.client.password ? this.client.password : password,
|
|
338
|
-
},
|
|
339
|
-
});
|
|
340
|
-
return data;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Set selfdeaf (Global)
|
|
345
|
-
* @param {boolean} status Whether or not the ClientUser is deafened
|
|
346
|
-
* @returns {boolean}
|
|
347
|
-
*/
|
|
348
|
-
setDeaf(status) {
|
|
349
|
-
if (typeof status !== 'boolean') throw new Error('Deaf status must be a boolean.');
|
|
350
|
-
this.client.ws.broadcast({
|
|
351
|
-
op: Opcodes.VOICE_STATE_UPDATE,
|
|
352
|
-
d: { self_deaf: status },
|
|
353
|
-
});
|
|
354
|
-
return status;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* Set selfmute (Global)
|
|
359
|
-
* @param {boolean} status Whether or not the ClientUser is muted
|
|
360
|
-
* @returns {boolean}
|
|
361
|
-
*/
|
|
362
|
-
setMute(status) {
|
|
363
|
-
if (typeof status !== 'boolean') throw new Error('Mute status must be a boolean.');
|
|
364
|
-
this.client.ws.broadcast({
|
|
365
|
-
op: Opcodes.VOICE_STATE_UPDATE,
|
|
366
|
-
d: { self_mute: status },
|
|
367
|
-
});
|
|
368
|
-
return status;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* Delete account. Warning: Cannot be changed once used!
|
|
373
|
-
* @param {string} password Password of the account
|
|
374
|
-
* @returns {Promise<ClientUser>}
|
|
375
|
-
*/
|
|
376
|
-
async deleteAccount(password) {
|
|
377
|
-
if (!password && !this.client.password) {
|
|
378
|
-
throw new Error('A password is required to delete an account.');
|
|
379
|
-
}
|
|
380
|
-
const data = await this.client.api.users['@me/delete'].post({
|
|
381
|
-
data: {
|
|
382
|
-
password: this.client.password ? this.client.password : password,
|
|
383
|
-
},
|
|
384
|
-
});
|
|
385
|
-
return data;
|
|
386
|
-
}
|
|
387
180
|
|
|
388
181
|
/**
|
|
389
182
|
* Options for setting activities
|
|
390
183
|
* @typedef {Object} ActivitiesOptions
|
|
391
|
-
* @property {string}
|
|
184
|
+
* @property {string} name Name of the activity
|
|
185
|
+
* @property {string} [state] State of the activity
|
|
392
186
|
* @property {ActivityType|number} [type] Type of the activity
|
|
393
187
|
* @property {string} [url] Twitch / YouTube stream URL
|
|
394
188
|
*/
|
|
@@ -440,7 +234,7 @@ class ClientUser extends User {
|
|
|
440
234
|
/**
|
|
441
235
|
* Options for setting an activity.
|
|
442
236
|
* @typedef {Object} ActivityOptions
|
|
443
|
-
* @property {string}
|
|
237
|
+
* @property {string} name Name of the activity
|
|
444
238
|
* @property {string} [url] Twitch / YouTube stream URL
|
|
445
239
|
* @property {ActivityType|number} [type] Type of the activity
|
|
446
240
|
* @property {number|number[]} [shardId] Shard Id(s) to have the activity set on
|
|
@@ -448,7 +242,7 @@ class ClientUser extends User {
|
|
|
448
242
|
|
|
449
243
|
/**
|
|
450
244
|
* Sets the activity the client user is playing.
|
|
451
|
-
* @param {string|ActivityOptions}
|
|
245
|
+
* @param {string|ActivityOptions} name Activity being played, or options for setting the activity
|
|
452
246
|
* @param {ActivityOptions} [options] Options for setting the activity
|
|
453
247
|
* @returns {ClientPresence}
|
|
454
248
|
* @example
|
|
@@ -457,15 +251,10 @@ class ClientUser extends User {
|
|
|
457
251
|
* @see {@link https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Document/RichPresence.md}
|
|
458
252
|
*/
|
|
459
253
|
setActivity(name, options = {}) {
|
|
460
|
-
if (!name) {
|
|
461
|
-
return this.setPresence({ activities: [], shardId: options.shardId });
|
|
462
|
-
}
|
|
254
|
+
if (!name) return this.setPresence({ activities: [], shardId: options.shardId });
|
|
463
255
|
|
|
464
256
|
const activity = Object.assign({}, options, typeof name === 'object' ? name : { name });
|
|
465
|
-
return this.setPresence({
|
|
466
|
-
activities: [activity],
|
|
467
|
-
shardId: activity.shardId,
|
|
468
|
-
});
|
|
257
|
+
return this.setPresence({ activities: [activity], shardId: activity.shardId });
|
|
469
258
|
}
|
|
470
259
|
|
|
471
260
|
/**
|
|
@@ -478,6 +267,81 @@ class ClientUser extends User {
|
|
|
478
267
|
return this.setPresence({ afk, shardId });
|
|
479
268
|
}
|
|
480
269
|
|
|
270
|
+
/**
|
|
271
|
+
* Sets the banner of the logged in client.
|
|
272
|
+
* @param {?(BufferResolvable|Base64Resolvable)} banner The new banner
|
|
273
|
+
* @returns {Promise<ClientUser>}
|
|
274
|
+
* @example
|
|
275
|
+
* // Set banner
|
|
276
|
+
* client.user.setBanner('./banner.png')
|
|
277
|
+
* .then(user => console.log(`New banner set!`))
|
|
278
|
+
* .catch(console.error);
|
|
279
|
+
*/
|
|
280
|
+
async setBanner(banner) {
|
|
281
|
+
banner = banner && (await DataResolver.resolveImage(banner));
|
|
282
|
+
return this.edit({ banner });
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Set HyperSquad House
|
|
287
|
+
* @param {string|number} type
|
|
288
|
+
* * `LEAVE`: 0
|
|
289
|
+
* * `HOUSE_BRAVERY`: 1
|
|
290
|
+
* * `HOUSE_BRILLIANCE`: 2
|
|
291
|
+
* * `HOUSE_BALANCE`: 3
|
|
292
|
+
* @returns {Promise<void>}
|
|
293
|
+
* @example
|
|
294
|
+
* // Set HyperSquad HOUSE_BRAVERY
|
|
295
|
+
* client.user.setHypeSquad(1); || client.user.setHypeSquad('HOUSE_BRAVERY');
|
|
296
|
+
* // Leave
|
|
297
|
+
* client.user.setHypeSquad(0);
|
|
298
|
+
*/
|
|
299
|
+
setHypeSquad(type) {
|
|
300
|
+
switch (type) {
|
|
301
|
+
case 'LEAVE': {
|
|
302
|
+
type = 0;
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
case 'HOUSE_BRAVERY': {
|
|
306
|
+
type = 1;
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
case 'HOUSE_BRILLIANCE': {
|
|
310
|
+
type = 2;
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
case 'HOUSE_BALANCE': {
|
|
314
|
+
type = 3;
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (type == 0) {
|
|
319
|
+
return this.client.api.hypesquad.online.delete();
|
|
320
|
+
} else {
|
|
321
|
+
return this.client.api.hypesquad.online.post({
|
|
322
|
+
data: { house_id: type },
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Set Accent color
|
|
329
|
+
* @param {ColorResolvable} color Color to set
|
|
330
|
+
* @returns {Promise<ClientUser>}
|
|
331
|
+
*/
|
|
332
|
+
setAccentColor(color = null) {
|
|
333
|
+
return this.edit({ accent_color: color ? Util.resolveColor(color) : null });
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Set About me
|
|
338
|
+
* @param {string} [bio=null] Bio to set
|
|
339
|
+
* @returns {Promise<ClientUser>}
|
|
340
|
+
*/
|
|
341
|
+
setAboutMe(bio = null) {
|
|
342
|
+
return this.edit({ bio });
|
|
343
|
+
}
|
|
344
|
+
|
|
481
345
|
/**
|
|
482
346
|
* Create an invite [Friend Invites]
|
|
483
347
|
* maxAge: 604800 | maxUses: 1
|
|
@@ -511,63 +375,10 @@ class ClientUser extends User {
|
|
|
511
375
|
|
|
512
376
|
/**
|
|
513
377
|
* Revoke all friend invites
|
|
514
|
-
* @returns {Promise<
|
|
515
|
-
*/
|
|
516
|
-
async revokeAllFriendInvites() {
|
|
517
|
-
const data = await this.client.api.users['@me'].invites.delete();
|
|
518
|
-
const collection = new Collection();
|
|
519
|
-
for (const invite of data) {
|
|
520
|
-
collection.set(invite.code, new Invite(this.client, invite));
|
|
521
|
-
}
|
|
522
|
-
return collection;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* Get a collection of messages mentioning clientUser
|
|
527
|
-
* @param {number} [limit=25] Maximum number of messages to get
|
|
528
|
-
* @param {boolean} [mentionRoles=true] Whether or not to mention roles
|
|
529
|
-
* @param {boolean} [mentionEveryone=true] Whether or not to mention `@everyone`
|
|
530
|
-
* @returns {Promise<Collection<Snowflake, Message>>}
|
|
531
|
-
*/
|
|
532
|
-
async getMentions(limit = 25, mentionRoles = true, mentionEveryone = true) {
|
|
533
|
-
// https://canary.discord.com/api/v9/users/@me/mentions?limit=25&roles=true&everyone=true
|
|
534
|
-
const data = await this.client.api.users['@me'].mentions.get({
|
|
535
|
-
query: {
|
|
536
|
-
limit,
|
|
537
|
-
roles: mentionRoles,
|
|
538
|
-
everyone: mentionEveryone,
|
|
539
|
-
},
|
|
540
|
-
});
|
|
541
|
-
const collection = new Collection();
|
|
542
|
-
for (const msg of data) {
|
|
543
|
-
collection.set(msg.id, new Message(this.client, msg));
|
|
544
|
-
}
|
|
545
|
-
return collection;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
/**
|
|
549
|
-
* Change Theme color
|
|
550
|
-
* @param {ColorResolvable} primary The primary color of the user's profile
|
|
551
|
-
* @param {ColorResolvable} accent The accent color of the user's profile
|
|
552
|
-
* @returns {Promise<ClientUser>}
|
|
378
|
+
* @returns {Promise<void>}
|
|
553
379
|
*/
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
// Check nitro
|
|
557
|
-
if (this.nitroType !== 'NITRO_BOOST') {
|
|
558
|
-
throw new Error_('NITRO_BOOST_REQUIRED', 'themeColors');
|
|
559
|
-
}
|
|
560
|
-
primary = Util.resolveColor(primary) || this.themeColors[0];
|
|
561
|
-
accent = Util.resolveColor(accent) || this.themeColors[1];
|
|
562
|
-
const data_ = await this.client.api.users['@me'].profile.patch({
|
|
563
|
-
data: {
|
|
564
|
-
theme_colors: [primary, accent],
|
|
565
|
-
},
|
|
566
|
-
});
|
|
567
|
-
this._ProfilePatch({
|
|
568
|
-
user_profile: data_,
|
|
569
|
-
});
|
|
570
|
-
return this;
|
|
380
|
+
revokeAllFriendInvites() {
|
|
381
|
+
return this.client.api.users['@me'].invites.delete();
|
|
571
382
|
}
|
|
572
383
|
|
|
573
384
|
/**
|
|
@@ -593,48 +404,18 @@ class ClientUser extends User {
|
|
|
593
404
|
update: type,
|
|
594
405
|
},
|
|
595
406
|
});
|
|
596
|
-
if (type !== 'STOP') this
|
|
597
|
-
else this
|
|
407
|
+
if (type !== 'STOP') this.#packageName = packageName;
|
|
408
|
+
else this.#packageName = null;
|
|
598
409
|
return this;
|
|
599
410
|
}
|
|
600
411
|
|
|
601
|
-
/**
|
|
602
|
-
* Sets Discord Playing status to "Playing on Samsung Galaxy". Only selected gamss from discords database works
|
|
603
|
-
* @param {string} packageName Android package name
|
|
604
|
-
* @param {?string} type Must be START, UPDATE, or STOP
|
|
605
|
-
* @returns {Promise<ClientUser>}
|
|
606
|
-
* @example
|
|
607
|
-
* // Set the client user's status
|
|
608
|
-
* client.user.setSamsungActivity('com.YostarJP.BlueArchive', 'START');
|
|
609
|
-
* // Update
|
|
610
|
-
* client.user.setSamsungActivity('com.miHoYo.bh3oversea', 'UPDATE');
|
|
611
|
-
* // Stop
|
|
612
|
-
* client.user.setSamsungActivity('com.miHoYo.GenshinImpact', 'STOP');
|
|
613
|
-
*/
|
|
614
|
-
async setSamsungActivity(packageName, type = 'START') {
|
|
615
|
-
type = type.toUpperCase();
|
|
616
|
-
if (!packageName || typeof packageName !== 'string') throw new Error('Package name is required.');
|
|
617
|
-
if (!['START', 'UPDATE', 'STOP'].includes(type)) throw new Error('Invalid type (Must be START, UPDATE, or STOP)');
|
|
618
|
-
await this.client.api.presences.post({
|
|
619
|
-
data: {
|
|
620
|
-
package_name: packageName,
|
|
621
|
-
update: type,
|
|
622
|
-
},
|
|
623
|
-
});
|
|
624
|
-
if (type !== 'STOP') this.#packageName = packageName;
|
|
625
|
-
else this.#packageName = null;
|
|
626
|
-
return this;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
412
|
/**
|
|
630
413
|
* Stop ringing
|
|
631
414
|
* @param {ChannelResolvable} channel DMChannel | GroupDMChannel
|
|
632
415
|
* @returns {Promise<void>}
|
|
633
416
|
*/
|
|
634
417
|
stopRinging(channel) {
|
|
635
|
-
|
|
636
|
-
if (!channel) return false;
|
|
637
|
-
return this.client.api.channels(id).call['stop-ringing'].post({
|
|
418
|
+
return this.client.api.channels(this.client.channels.resolveId(channel)).call['stop-ringing'].post({
|
|
638
419
|
data: {},
|
|
639
420
|
});
|
|
640
421
|
}
|