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
|
@@ -194,7 +194,7 @@ class AutoModerationRule extends Base {
|
|
|
194
194
|
* @returns {Promise<AutoModerationRule>}
|
|
195
195
|
*/
|
|
196
196
|
setKeywordFilter(keywordFilter, reason) {
|
|
197
|
-
return this.edit({ triggerMetadata: { keywordFilter }, reason });
|
|
197
|
+
return this.edit({ triggerMetadata: { ...this.triggerMetadata, keywordFilter }, reason });
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
/**
|
|
@@ -205,7 +205,7 @@ class AutoModerationRule extends Base {
|
|
|
205
205
|
* @returns {Promise<AutoModerationRule>}
|
|
206
206
|
*/
|
|
207
207
|
setRegexPatterns(regexPatterns, reason) {
|
|
208
|
-
return this.edit({ triggerMetadata: { regexPatterns }, reason });
|
|
208
|
+
return this.edit({ triggerMetadata: { ...this.triggerMetadata, regexPatterns }, reason });
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
/**
|
|
@@ -215,7 +215,7 @@ class AutoModerationRule extends Base {
|
|
|
215
215
|
* @returns {Promise<AutoModerationRule>}
|
|
216
216
|
*/
|
|
217
217
|
setPresets(presets, reason) {
|
|
218
|
-
return this.edit({ triggerMetadata: { presets }, reason });
|
|
218
|
+
return this.edit({ triggerMetadata: { ...this.triggerMetadata, presets }, reason });
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
/**
|
|
@@ -225,7 +225,7 @@ class AutoModerationRule extends Base {
|
|
|
225
225
|
* @returns {Promise<AutoModerationRule>}
|
|
226
226
|
*/
|
|
227
227
|
setAllowList(allowList, reason) {
|
|
228
|
-
return this.edit({ triggerMetadata: { allowList }, reason });
|
|
228
|
+
return this.edit({ triggerMetadata: { ...this.triggerMetadata, allowList }, reason });
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
/**
|
|
@@ -235,7 +235,7 @@ class AutoModerationRule extends Base {
|
|
|
235
235
|
* @returns {Promise<AutoModerationRule>}
|
|
236
236
|
*/
|
|
237
237
|
setMentionTotalLimit(mentionTotalLimit, reason) {
|
|
238
|
-
return this.edit({ triggerMetadata: { mentionTotalLimit }, reason });
|
|
238
|
+
return this.edit({ triggerMetadata: { ...this.triggerMetadata, mentionTotalLimit }, reason });
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
/**
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const CommandInteractionOptionResolver = require('./CommandInteractionOptionResolver');
|
|
4
4
|
const Interaction = require('./Interaction');
|
|
5
|
+
const { Error } = require('../errors');
|
|
5
6
|
const { InteractionResponseTypes, ApplicationCommandOptionTypes } = require('../util/Constants');
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const GuildChannel = require('./GuildChannel');
|
|
4
4
|
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
|
5
5
|
const GuildTextThreadManager = require('../managers/GuildTextThreadManager');
|
|
6
|
-
const InteractionManager = require('../managers/InteractionManager');
|
|
7
6
|
const MessageManager = require('../managers/MessageManager');
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -21,12 +20,6 @@ class BaseGuildTextChannel extends GuildChannel {
|
|
|
21
20
|
*/
|
|
22
21
|
this.messages = new MessageManager(this);
|
|
23
22
|
|
|
24
|
-
/**
|
|
25
|
-
* A manager of the interactions sent to this channel
|
|
26
|
-
* @type {InteractionManager}
|
|
27
|
-
*/
|
|
28
|
-
this.interactions = new InteractionManager(this);
|
|
29
|
-
|
|
30
23
|
/**
|
|
31
24
|
* A manager of the threads belonging to this channel
|
|
32
25
|
* @type {GuildTextThreadManager}
|
|
@@ -81,6 +74,16 @@ class BaseGuildTextChannel extends GuildChannel {
|
|
|
81
74
|
this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
|
|
82
75
|
}
|
|
83
76
|
|
|
77
|
+
if ('default_thread_rate_limit_per_user' in data) {
|
|
78
|
+
/**
|
|
79
|
+
* The initial rate limit per user (slowmode) to set on newly created threads in a channel.
|
|
80
|
+
* @type {?number}
|
|
81
|
+
*/
|
|
82
|
+
this.defaultThreadRateLimitPerUser = data.default_thread_rate_limit_per_user;
|
|
83
|
+
} else {
|
|
84
|
+
this.defaultThreadRateLimitPerUser ??= null;
|
|
85
|
+
}
|
|
86
|
+
|
|
84
87
|
if ('messages' in data) {
|
|
85
88
|
for (const message of data.messages) this.messages._add(message);
|
|
86
89
|
}
|
|
@@ -177,15 +180,10 @@ class BaseGuildTextChannel extends GuildChannel {
|
|
|
177
180
|
sendTyping() {}
|
|
178
181
|
createMessageCollector() {}
|
|
179
182
|
awaitMessages() {}
|
|
180
|
-
createMessageComponentCollector() {}
|
|
181
|
-
awaitMessageComponent() {}
|
|
182
|
-
bulkDelete() {}
|
|
183
183
|
fetchWebhooks() {}
|
|
184
184
|
createWebhook() {}
|
|
185
185
|
setRateLimitPerUser() {}
|
|
186
186
|
setNSFW() {}
|
|
187
|
-
sendSlash() {}
|
|
188
|
-
searchInteraction() {}
|
|
189
187
|
}
|
|
190
188
|
|
|
191
189
|
TextBasedChannel.applyToClass(BaseGuildTextChannel, true);
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const { Collection } = require('@discordjs/collection');
|
|
4
4
|
const GuildChannel = require('./GuildChannel');
|
|
5
5
|
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
|
6
|
-
const InteractionManager = require('../managers/InteractionManager');
|
|
7
6
|
const MessageManager = require('../managers/MessageManager');
|
|
8
7
|
const { VideoQualityModes } = require('../util/Constants');
|
|
9
8
|
const Permissions = require('../util/Permissions');
|
|
@@ -28,12 +27,6 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
28
27
|
*/
|
|
29
28
|
this.nsfw = Boolean(data.nsfw);
|
|
30
29
|
|
|
31
|
-
/**
|
|
32
|
-
* A manager of the interactions sent to this channel
|
|
33
|
-
* @type {InteractionManager}
|
|
34
|
-
*/
|
|
35
|
-
this.interactions = new InteractionManager(this);
|
|
36
|
-
|
|
37
30
|
this._patch(data);
|
|
38
31
|
}
|
|
39
32
|
|
|
@@ -95,7 +88,15 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
95
88
|
}
|
|
96
89
|
|
|
97
90
|
if ('nsfw' in data) {
|
|
98
|
-
this.nsfw =
|
|
91
|
+
this.nsfw = data.nsfw;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if ('status' in data) {
|
|
95
|
+
/**
|
|
96
|
+
* The status of the voice channel (max 500 characters)
|
|
97
|
+
* @type {?string}
|
|
98
|
+
*/
|
|
99
|
+
this.status = data.status;
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
|
|
@@ -170,11 +171,11 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
170
171
|
* Sets the bitrate of the channel.
|
|
171
172
|
* @param {number} bitrate The new bitrate
|
|
172
173
|
* @param {string} [reason] Reason for changing the channel's bitrate
|
|
173
|
-
* @returns {Promise<
|
|
174
|
+
* @returns {Promise<BaseGuildVoiceChannel>}
|
|
174
175
|
* @example
|
|
175
176
|
* // Set the bitrate of a voice channel
|
|
176
|
-
*
|
|
177
|
-
* .then(
|
|
177
|
+
* channel.setBitrate(48_000)
|
|
178
|
+
* .then(channel => console.log(`Set bitrate to ${channel.bitrate}bps for ${channel.name}`))
|
|
178
179
|
* .catch(console.error);
|
|
179
180
|
*/
|
|
180
181
|
setBitrate(bitrate, reason) {
|
|
@@ -201,11 +202,11 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
201
202
|
* Sets the user limit of the channel.
|
|
202
203
|
* @param {number} userLimit The new user limit
|
|
203
204
|
* @param {string} [reason] Reason for changing the user limit
|
|
204
|
-
* @returns {Promise<
|
|
205
|
+
* @returns {Promise<BaseGuildVoiceChannel>}
|
|
205
206
|
* @example
|
|
206
207
|
* // Set the user limit of a voice channel
|
|
207
|
-
*
|
|
208
|
-
* .then(
|
|
208
|
+
* channel.setUserLimit(42)
|
|
209
|
+
* .then(channel => console.log(`Set user limit to ${channel.userLimit} for ${channel.name}`))
|
|
209
210
|
* .catch(console.error);
|
|
210
211
|
*/
|
|
211
212
|
setUserLimit(userLimit, reason) {
|
|
@@ -216,7 +217,7 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
216
217
|
* Sets the camera video quality mode of the channel.
|
|
217
218
|
* @param {VideoQualityMode|number} videoQualityMode The new camera video quality mode.
|
|
218
219
|
* @param {string} [reason] Reason for changing the camera video quality mode.
|
|
219
|
-
* @returns {Promise<
|
|
220
|
+
* @returns {Promise<BaseGuildVoiceChannel>}
|
|
220
221
|
*/
|
|
221
222
|
setVideoQualityMode(videoQualityMode, reason) {
|
|
222
223
|
return this.edit({ videoQualityMode }, reason);
|
|
@@ -229,9 +230,6 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
229
230
|
sendTyping() {}
|
|
230
231
|
createMessageCollector() {}
|
|
231
232
|
awaitMessages() {}
|
|
232
|
-
createMessageComponentCollector() {}
|
|
233
|
-
awaitMessageComponent() {}
|
|
234
|
-
bulkDelete() {}
|
|
235
233
|
fetchWebhooks() {}
|
|
236
234
|
createWebhook() {}
|
|
237
235
|
setRateLimitPerUser() {}
|
|
@@ -7,7 +7,7 @@ const Base = require('./Base');
|
|
|
7
7
|
* Represents a call
|
|
8
8
|
* @extends {Base}
|
|
9
9
|
*/
|
|
10
|
-
class
|
|
10
|
+
class CallState extends Base {
|
|
11
11
|
constructor(client, data) {
|
|
12
12
|
super(client);
|
|
13
13
|
/**
|
|
@@ -16,14 +16,11 @@ class Call extends Base {
|
|
|
16
16
|
*/
|
|
17
17
|
this.channelId = data.channel_id;
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
* The list of user ID who is ringing
|
|
21
|
-
* @type {Collection<Snowflake, User>}
|
|
22
|
-
*/
|
|
23
|
-
this.ringing = new Collection();
|
|
19
|
+
this._ringing = [];
|
|
24
20
|
|
|
25
21
|
this._patch(data);
|
|
26
22
|
}
|
|
23
|
+
|
|
27
24
|
_patch(data) {
|
|
28
25
|
if ('region' in data) {
|
|
29
26
|
/**
|
|
@@ -33,26 +30,34 @@ class Call extends Base {
|
|
|
33
30
|
this.region = data.region;
|
|
34
31
|
}
|
|
35
32
|
if ('ringing' in data) {
|
|
36
|
-
|
|
37
|
-
this.ringing.set(userId, this.client.users.cache.get(userId));
|
|
38
|
-
}
|
|
33
|
+
this._ringing = data.ringing;
|
|
39
34
|
}
|
|
40
35
|
}
|
|
36
|
+
|
|
41
37
|
/**
|
|
42
38
|
* The channel of the call
|
|
43
|
-
* @type {?DMChannel|
|
|
39
|
+
* @type {?DMChannel|GroupDMChannel}
|
|
44
40
|
*/
|
|
45
41
|
get channel() {
|
|
46
42
|
return this.client.channels.cache.get(this.channelId);
|
|
47
43
|
}
|
|
44
|
+
|
|
48
45
|
/**
|
|
49
46
|
* Sets the voice region of the call
|
|
50
47
|
* @param {string} region Region of the call
|
|
51
48
|
* @returns {Promise<void>}
|
|
52
49
|
*/
|
|
53
|
-
|
|
50
|
+
setRTCRegion(region) {
|
|
54
51
|
return this.client.api.channels(this.channelId).call.patch({ data: { region } });
|
|
55
52
|
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The list of user ID who is ringing
|
|
56
|
+
* @type {Collection<Snowflake, User>}
|
|
57
|
+
*/
|
|
58
|
+
get ringing() {
|
|
59
|
+
return new Collection(this._ringing.map(id => [id, this.client.users.cache.get(id)]));
|
|
60
|
+
}
|
|
56
61
|
}
|
|
57
62
|
|
|
58
|
-
module.exports =
|
|
63
|
+
module.exports = CallState;
|
|
@@ -62,6 +62,8 @@ class CategoryChannel extends GuildChannel {
|
|
|
62
62
|
* @property {?DefaultReactionEmoji} [defaultReactionEmoji] The emoji to set as the default reaction emoji
|
|
63
63
|
* @property {number} [defaultThreadRateLimitPerUser] The rate limit per user (slowmode) to set on forum posts
|
|
64
64
|
* @property {?SortOrderType} [defaultSortOrder] The default sort order mode to set on the new channel
|
|
65
|
+
* @property {number} [defaultThreadRateLimitPerUser] The initial rate limit per user (slowmode)
|
|
66
|
+
* to set on newly created threads in a channel.
|
|
65
67
|
* @property {string} [reason] Reason for creating the new channel
|
|
66
68
|
*/
|
|
67
69
|
|
|
@@ -53,7 +53,6 @@ class Channel extends Base {
|
|
|
53
53
|
if ('flags' in data) {
|
|
54
54
|
/**
|
|
55
55
|
* The flags that are applied to the channel.
|
|
56
|
-
* <info>This is only `null` in a {@link PartialGroupDMChannel}. In all other cases, it is not `null`.</info>
|
|
57
56
|
* @type {?Readonly<ChannelFlags>}
|
|
58
57
|
*/
|
|
59
58
|
this.flags = new ChannelFlags(data.flags).freeze();
|
|
@@ -203,8 +202,8 @@ class Channel extends Base {
|
|
|
203
202
|
if ((data.recipients && data.type !== ChannelTypes.GROUP_DM) || data.type === ChannelTypes.DM) {
|
|
204
203
|
channel = new DMChannel(client, data);
|
|
205
204
|
} else if (data.type === ChannelTypes.GROUP_DM) {
|
|
206
|
-
const
|
|
207
|
-
channel = new
|
|
205
|
+
const GroupDMChannel = require('./GroupDMChannel');
|
|
206
|
+
channel = new GroupDMChannel(client, data);
|
|
208
207
|
}
|
|
209
208
|
} else {
|
|
210
209
|
guild ??= client.guilds.cache.get(data.guild_id);
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const { Presence } = require('./Presence');
|
|
4
4
|
const { TypeError } = require('../errors');
|
|
5
|
-
const {
|
|
5
|
+
const { ActivityTypes, Opcodes } = require('../util/Constants');
|
|
6
|
+
|
|
7
|
+
const CustomStatusActivityTypes = [ActivityTypes.CUSTOM, ActivityTypes[ActivityTypes.CUSTOM]];
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Represents the client's presence.
|
|
@@ -20,7 +22,6 @@ class ClientPresence extends Presence {
|
|
|
20
22
|
*/
|
|
21
23
|
set(presence) {
|
|
22
24
|
const packet = this._parse(presence);
|
|
23
|
-
// Parse with custom class
|
|
24
25
|
this._patch(packet, true);
|
|
25
26
|
if (typeof presence.shardId === 'undefined') {
|
|
26
27
|
this.client.ws.broadcast({ op: Opcodes.STATUS_UPDATE, d: packet });
|
|
@@ -31,8 +32,6 @@ class ClientPresence extends Presence {
|
|
|
31
32
|
} else {
|
|
32
33
|
this.client.ws.shards.get(presence.shardId).send({ op: Opcodes.STATUS_UPDATE, d: packet });
|
|
33
34
|
}
|
|
34
|
-
// Parse with default class
|
|
35
|
-
// this._patch(packet, false);
|
|
36
35
|
return this;
|
|
37
36
|
}
|
|
38
37
|
|
|
@@ -46,15 +45,20 @@ class ClientPresence extends Presence {
|
|
|
46
45
|
const data = {
|
|
47
46
|
activities: [],
|
|
48
47
|
afk: typeof afk === 'boolean' ? afk : false,
|
|
49
|
-
since:
|
|
48
|
+
since: typeof since === 'number' && !Number.isNaN(since) ? since : null,
|
|
50
49
|
status: status ?? this.status,
|
|
51
50
|
};
|
|
52
51
|
if (activities?.length) {
|
|
53
52
|
for (const [i, activity] of activities.entries()) {
|
|
54
|
-
if (
|
|
55
|
-
|
|
53
|
+
if (typeof activity.name !== 'string') throw new TypeError('INVALID_TYPE', `activities[${i}].name`, 'string');
|
|
54
|
+
|
|
55
|
+
activity.type ??= ActivityTypes.PLAYING;
|
|
56
|
+
|
|
57
|
+
if (CustomStatusActivityTypes.includes(activity.type) && !activity.state) {
|
|
58
|
+
activity.state = activity.name;
|
|
59
|
+
activity.name = 'Custom Status';
|
|
56
60
|
}
|
|
57
|
-
|
|
61
|
+
|
|
58
62
|
data.activities.push(
|
|
59
63
|
Object.assign(activity, {
|
|
60
64
|
type: typeof activity.type === 'number' ? activity.type : ActivityTypes[activity.type],
|