djs-selfbot-v13 3.7.27 → 3.7.28
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/actions/GuildJoinRequestCreate.js +11 -4
- package/src/client/actions/GuildJoinRequestDelete.js +21 -11
- package/src/client/websocket/handlers/GUILD_JOIN_REQUEST_UPDATE.js +6 -0
- package/src/client/websocket/handlers/index.js +1 -0
- package/src/util/Constants.js +2 -0
package/package.json
CHANGED
|
@@ -6,16 +6,23 @@ const { Events } = require('../../util/Constants');
|
|
|
6
6
|
class GuildJoinRequestCreateAction extends Action {
|
|
7
7
|
handle(data) {
|
|
8
8
|
const client = this.client;
|
|
9
|
-
const
|
|
9
|
+
const guildId = data.guild_id ?? data.request?.guild_id;
|
|
10
|
+
const guild = client.guilds.cache.get(guildId);
|
|
10
11
|
|
|
11
12
|
if (guild) {
|
|
12
|
-
const requestData = data.request
|
|
13
|
+
const requestData = data.request ?? data;
|
|
14
|
+
// Ensure guild_id is present on the request data
|
|
15
|
+
if (!requestData.guild_id) requestData.guild_id = guildId;
|
|
16
|
+
// Pass status from top-level if present
|
|
17
|
+
if (data.status && !requestData.application_status) {
|
|
18
|
+
requestData.application_status = data.status;
|
|
19
|
+
}
|
|
13
20
|
const joinRequest = guild.demandes._add(requestData);
|
|
14
21
|
|
|
15
22
|
/**
|
|
16
|
-
* Emitted whenever a join request is created.
|
|
23
|
+
* Emitted whenever a join request is created or updated.
|
|
17
24
|
* @event Client#guildJoinRequestCreate
|
|
18
|
-
* @param {GuildJoinRequest} joinRequest The
|
|
25
|
+
* @param {GuildJoinRequest} joinRequest The join request
|
|
19
26
|
*/
|
|
20
27
|
client.emit(Events.GUILD_JOIN_REQUEST_CREATE, joinRequest);
|
|
21
28
|
|
|
@@ -6,22 +6,32 @@ const { Events } = require('../../util/Constants');
|
|
|
6
6
|
class GuildJoinRequestDeleteAction extends Action {
|
|
7
7
|
handle(data) {
|
|
8
8
|
const client = this.client;
|
|
9
|
-
const
|
|
9
|
+
const guildId = data.guild_id ?? data.request?.guild_id;
|
|
10
|
+
const guild = client.guilds.cache.get(guildId);
|
|
10
11
|
|
|
11
12
|
if (guild) {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const userId = data.user_id ?? data.request?.user_id;
|
|
14
|
+
const joinRequest = guild.demandes.cache.get(userId);
|
|
15
|
+
guild.demandes.cache.delete(userId);
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Emitted whenever a join request is deleted/cancelled.
|
|
19
|
+
* @event Client#guildJoinRequestDelete
|
|
20
|
+
* @param {GuildJoinRequest} joinRequest The deleted join request (or raw data if not cached)
|
|
21
|
+
* @param {Guild} guild The guild
|
|
22
|
+
*/
|
|
23
|
+
if (joinRequest) {
|
|
21
24
|
client.emit(Events.GUILD_JOIN_REQUEST_DELETE, joinRequest);
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
} else {
|
|
26
|
+
// Emit with a minimal object even if not previously cached
|
|
27
|
+
const GuildJoinRequest = require('../../structures/GuildJoinRequest');
|
|
28
|
+
const requestData = data.request ?? data;
|
|
29
|
+
if (!requestData.guild_id) requestData.guild_id = guildId;
|
|
30
|
+
const newRequest = new GuildJoinRequest(client, requestData, guild);
|
|
31
|
+
client.emit(Events.GUILD_JOIN_REQUEST_DELETE, newRequest);
|
|
24
32
|
}
|
|
33
|
+
|
|
34
|
+
return { joinRequest };
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
return {};
|
|
@@ -22,6 +22,7 @@ const handlers = Object.fromEntries([
|
|
|
22
22
|
['GUILD_MEMBERS_CHUNK', require('./GUILD_MEMBERS_CHUNK')],
|
|
23
23
|
['GUILD_INTEGRATIONS_UPDATE', require('./GUILD_INTEGRATIONS_UPDATE')],
|
|
24
24
|
['GUILD_JOIN_REQUEST_CREATE', require('./GUILD_JOIN_REQUEST_CREATE')],
|
|
25
|
+
['GUILD_JOIN_REQUEST_UPDATE', require('./GUILD_JOIN_REQUEST_UPDATE')],
|
|
25
26
|
['GUILD_JOIN_REQUEST_DELETE', require('./GUILD_JOIN_REQUEST_DELETE')],
|
|
26
27
|
['GUILD_ROLE_CREATE', require('./GUILD_ROLE_CREATE')],
|
|
27
28
|
['GUILD_ROLE_DELETE', require('./GUILD_ROLE_DELETE')],
|
package/src/util/Constants.js
CHANGED
|
@@ -478,6 +478,7 @@ exports.Events = {
|
|
|
478
478
|
MESSAGE_POLL_VOTE_REMOVE: 'messagePollVoteRemove',
|
|
479
479
|
VOICE_CHANNEL_EFFECT_SEND: 'voiceChannelEffectSend',
|
|
480
480
|
GUILD_JOIN_REQUEST_CREATE: 'guildJoinRequestCreate',
|
|
481
|
+
GUILD_JOIN_REQUEST_UPDATE: 'guildJoinRequestCreate',
|
|
481
482
|
GUILD_JOIN_REQUEST_DELETE: 'guildJoinRequestDelete',
|
|
482
483
|
// Djs v12
|
|
483
484
|
VOICE_BROADCAST_SUBSCRIBE: 'subscribe',
|
|
@@ -644,6 +645,7 @@ exports.WSEvents = keyMirror([
|
|
|
644
645
|
'GUILD_SCHEDULED_EVENT_USER_REMOVE',
|
|
645
646
|
'GUILD_AUDIT_LOG_ENTRY_CREATE',
|
|
646
647
|
'GUILD_JOIN_REQUEST_CREATE',
|
|
648
|
+
'GUILD_JOIN_REQUEST_UPDATE',
|
|
647
649
|
'GUILD_JOIN_REQUEST_DELETE',
|
|
648
650
|
]);
|
|
649
651
|
|