djs-selfbot-v13 3.7.26 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "djs-selfbot-v13",
3
- "version": "3.7.26",
3
+ "version": "3.7.28",
4
4
  "description": "An unofficial discord.js fork for creating selfbots",
5
5
  "main": "./src/index.js",
6
6
  "types": "./typings/index.d.ts",
@@ -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 guild = client.guilds.cache.get(data.guild_id);
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 || data;
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 created join request
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 guild = client.guilds.cache.get(data.guild_id);
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 joinRequest = guild.demandes.cache.get(data.user_id);
13
- if (joinRequest) {
14
- guild.demandes.cache.delete(data.user_id);
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
- * Emitted whenever a join request is deleted.
18
- * @event Client#guildJoinRequestDelete
19
- * @param {GuildJoinRequest} joinRequest The deleted join request
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
- return { joinRequest };
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 {};
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ module.exports = (client, packet) => {
4
+ // UPDATE uses the same action as CREATE (upsert into cache)
5
+ client.actions.GuildJoinRequestCreate.handle(packet.d);
6
+ };
@@ -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')],
@@ -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
 
@@ -6362,6 +6362,8 @@ export interface ClientEvents extends BaseClientEvents {
6362
6362
  callDelete: [call: CallState];
6363
6363
  messagePollVoteAdd: [pollAnswer: PollAnswer, userId: Snowflake];
6364
6364
  messagePollVoteRemove: [pollAnswer: PollAnswer, userId: Snowflake];
6365
+ guildJoinRequestCreate: [joinRequest: GuildJoinRequest];
6366
+ guildJoinRequestDelete: [joinRequest: GuildJoinRequest];
6365
6367
  }
6366
6368
 
6367
6369
  export interface ClientFetchInviteOptions {