djs-selfbot-v13 3.7.12 → 3.7.14

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 CHANGED
@@ -1,5 +1,3 @@
1
- > [!IMPORTANT]
2
- > **This project is a fork of the [discord.js-selfbot-v13](https://github.com/aiko-chan-ai/discord.js-selfbot-v13) archived project.**
3
1
 
4
2
  <div align="center">
5
3
  <br />
@@ -10,15 +8,18 @@
10
8
 
11
9
  ## About
12
10
 
13
- <strong>Welcome to `discord.js-selfbot-v13@v3.7`, based on `discord.js@13.17` and backport `discord.js@14.21.0`</strong>
11
+ <strong>Welcome to `djs-selfbot-v13@v3.7`, based on `discord.js@13.17` and backport `discord.js@14.21.0`</strong>
12
+
13
+ - djs-selfbot-v13 is a [Node.js](https://nodejs.org) module that allows user accounts to interact with the Discord API v9.
14
14
 
15
- - discord.js-selfbot-v13 is a [Node.js](https://nodejs.org) module that allows user accounts to interact with the Discord API v9.
15
+ > [!IMPORTANT]
16
+ > **This project is a fork of the [discord.js-selfbot-v13](https://github.com/aiko-chan-ai/discord.js-selfbot-v13) archived project.**
16
17
 
17
18
 
18
19
  <div align="center">
19
20
  <p>
20
- <a href="https://www.npmjs.com/package/discord.js-selfbot-v13"><img src="https://img.shields.io/npm/v/discord.js-selfbot-v13.svg" alt="npm version" /></a>
21
- <a href="https://www.npmjs.com/package/discord.js-selfbot-v13"><img src="https://img.shields.io/npm/dt/discord.js-selfbot-v13.svg" alt="npm downloads" /></a>
21
+ <a href="https://www.npmjs.com/package/djs-selfbot-v13"><img src="https://img.shields.io/npm/v/djs-selfbot-v13.svg" alt="npm version" /></a>
22
+ <a href="https://www.npmjs.com/package/djs-selfbot-v13"><img src="https://img.shields.io/npm/dt/djs-selfbot-v13.svg" alt="npm downloads" /></a>
22
23
  <a href="https://github.com/002-sans/djs-selfbot-v13/actions"><img src="https://github.com/002-sans/djs-selfbot-v13/actions/workflows/lint.yml/badge.svg" alt="Tests status" /></a>
23
24
  </p>
24
25
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "djs-selfbot-v13",
3
- "version": "3.7.12",
3
+ "version": "3.7.14",
4
4
  "description": "An unofficial discord.js fork for creating selfbots",
5
5
  "main": "./src/index.js",
6
6
  "types": "./typings/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "repository": {
31
31
  "type": "git",
32
- "url": "git+https://github.com/aiko-chan-ai/djs-selfbot-v13.git"
32
+ "url": "git+https://github.com/002-sans/djs-selfbot-v13.git"
33
33
  },
34
34
  "keywords": [
35
35
  "discord.js",
@@ -47,9 +47,9 @@
47
47
  "author": "aiko-chan-ai",
48
48
  "license": "GNU General Public License v3.0",
49
49
  "bugs": {
50
- "url": "https://github.com/aiko-chan-ai/djs-selfbot-v13/issues"
50
+ "url": "https://github.com/002-sans/djs-selfbot-v13/issues"
51
51
  },
52
- "homepage": "https://github.com/aiko-chan-ai/djs-selfbot-v13#readme",
52
+ "homepage": "https://djs-selfbot.vercel.app/",
53
53
  "dependencies": {
54
54
  "@discordjs/builders": "^1.6.3",
55
55
  "@discordjs/collection": "^2.1.1",
@@ -248,6 +248,11 @@ class QuestManager extends BaseManager {
248
248
  * @returns {Promise<void>}
249
249
  */
250
250
  async doingQuest(quest) {
251
+ // Ensure quest is a proper Quest instance
252
+ if (!(quest instanceof Quest)) {
253
+ quest = new Quest(quest);
254
+ }
255
+
251
256
  const questName = quest.config.messages?.quest_name || 'Unknown Quest';
252
257
 
253
258
  if (!quest.isEnrolledQuest())
@@ -334,7 +339,8 @@ class QuestManager extends BaseManager {
334
339
 
335
340
  /**
336
341
  * Get cache size
337
- * @returns {number}
342
+ * @type {number}
343
+ * @readonly
338
344
  */
339
345
  get size() {
340
346
  return this.cache.size;
@@ -157,6 +157,59 @@ class DMChannel extends Channel {
157
157
  });
158
158
  }
159
159
 
160
+ /**
161
+ * Search for messages in this DM/Group channel
162
+ * @param {Object} [options] Search options
163
+ * @param {string} [options.authorId] Filter by author ID
164
+ * @param {string[]} [options.has] Filter by attachment type ('image', 'video', 'file', 'sticker', 'embed', 'link')
165
+ * @param {boolean} [options.pinned] Filter pinned messages only
166
+ * @param {string} [options.sortBy='timestamp'] Sort by ('timestamp' or 'relevance')
167
+ * @param {string} [options.sortOrder='desc'] Sort order ('asc' or 'desc')
168
+ * @param {number} [options.offset=0] Pagination offset
169
+ * @param {number} [options.limit] Max number of messages to return
170
+ * @param {Date|number} [options.maxTime] Only return messages before this date
171
+ * @returns {Promise<Object>}
172
+ */
173
+ async search(options = {}) {
174
+ const {
175
+ authorId,
176
+ has = [],
177
+ pinned,
178
+ sortBy = 'timestamp',
179
+ sortOrder = 'desc',
180
+ offset = 0,
181
+ limit,
182
+ maxTime,
183
+ } = options;
184
+
185
+ const query = {
186
+ sort_by: sortBy,
187
+ sort_order: sortOrder,
188
+ offset,
189
+ };
190
+
191
+ if (authorId) query.author_id = authorId;
192
+ if (pinned) query.pinned = true;
193
+
194
+ if (maxTime) {
195
+ const time = new Date(maxTime).getTime();
196
+ const maxId = (BigInt(time) - 1420070400000n) << 22n;
197
+ query.max_id = maxId.toString();
198
+ }
199
+
200
+ for (const hasType of has) {
201
+ if (!query.has) query.has = [];
202
+ query.has.push(hasType);
203
+ }
204
+
205
+ const data = await this.client.api.channels(this.id).messages.search.get({ query });
206
+
207
+ if (limit && data.messages)
208
+ data.messages = data.messages.flat().slice(0, limit);
209
+
210
+ return data;
211
+ }
212
+
160
213
  /**
161
214
  * The user in this voice-based channel
162
215
  * @type {Collection<Snowflake, User>}
@@ -204,12 +257,12 @@ class DMChannel extends Channel {
204
257
 
205
258
  // These are here only for documentation purposes - they are implemented by TextBasedChannel
206
259
  /* eslint-disable no-empty-function */
207
- get lastMessage() {}
208
- get lastPinAt() {}
209
- send() {}
210
- sendTyping() {}
211
- createMessageCollector() {}
212
- awaitMessages() {}
260
+ get lastMessage() { }
261
+ get lastPinAt() { }
262
+ send() { }
263
+ sendTyping() { }
264
+ createMessageCollector() { }
265
+ awaitMessages() { }
213
266
  // Doesn't work on DM channels; setRateLimitPerUser() {}
214
267
  // Doesn't work on DM channels; setNSFW() {}
215
268
  }
@@ -314,6 +314,59 @@ class GroupDMChannel extends Channel {
314
314
  });
315
315
  }
316
316
 
317
+ /**
318
+ * Search for messages in this DM/Group channel
319
+ * @param {Object} [options] Search options
320
+ * @param {string} [options.authorId] Filter by author ID
321
+ * @param {string[]} [options.has] Filter by attachment type ('image', 'video', 'file', 'sticker', 'embed', 'link')
322
+ * @param {boolean} [options.pinned] Filter pinned messages only
323
+ * @param {string} [options.sortBy='timestamp'] Sort by ('timestamp' or 'relevance')
324
+ * @param {string} [options.sortOrder='desc'] Sort order ('asc' or 'desc')
325
+ * @param {number} [options.offset=0] Pagination offset
326
+ * @param {number} [options.limit] Max number of messages to return
327
+ * @param {Date|number} [options.maxTime] Only return messages before this date
328
+ * @returns {Promise<Object>}
329
+ */
330
+ async search(options = {}) {
331
+ const {
332
+ authorId,
333
+ has = [],
334
+ pinned,
335
+ sortBy = 'timestamp',
336
+ sortOrder = 'desc',
337
+ offset = 0,
338
+ limit,
339
+ maxTime,
340
+ } = options;
341
+
342
+ const query = {
343
+ sort_by: sortBy,
344
+ sort_order: sortOrder,
345
+ offset,
346
+ };
347
+
348
+ if (authorId) query.author_id = authorId;
349
+ if (pinned) query.pinned = true;
350
+
351
+ if (maxTime) {
352
+ const time = new Date(maxTime).getTime();
353
+ const maxId = (BigInt(time) - 1420070400000n) << 22n;
354
+ query.max_id = maxId.toString();
355
+ }
356
+
357
+ for (const hasType of has) {
358
+ if (!query.has) query.has = [];
359
+ query.has.push(hasType);
360
+ }
361
+
362
+ const data = await this.client.api.channels(this.id).messages.search.get({ query });
363
+
364
+ if (limit && data.messages)
365
+ data.messages = data.messages.flat().slice(0, limit);
366
+
367
+ return data;
368
+ }
369
+
317
370
  /**
318
371
  * Sync VoiceState of this Group DMChannel.
319
372
  * @returns {undefined}
@@ -374,12 +427,12 @@ class GroupDMChannel extends Channel {
374
427
 
375
428
  // These are here only for documentation purposes - they are implemented by TextBasedChannel
376
429
  /* eslint-disable no-empty-function */
377
- get lastMessage() {}
378
- get lastPinAt() {}
379
- send() {}
380
- sendTyping() {}
381
- createMessageCollector() {}
382
- awaitMessages() {}
430
+ get lastMessage() { }
431
+ get lastPinAt() { }
432
+ send() { }
433
+ sendTyping() { }
434
+ createMessageCollector() { }
435
+ awaitMessages() { }
383
436
  // Doesn't work on DM channels; setRateLimitPerUser() {}
384
437
  // Doesn't work on DM channels; setNSFW() {}
385
438
  }
@@ -1746,10 +1746,8 @@ class Guild extends AnonymousGuild {
1746
1746
 
1747
1747
  const data = await this.client.api.guilds(this.id).messages.search.get({ query });
1748
1748
 
1749
- if (limit && data.messages) {
1750
- // data.messages est souvent un tableau de tableaux dans l'API search
1749
+ if (limit && data.messages)
1751
1750
  data.messages = data.messages.flat().slice(0, limit);
1752
- }
1753
1751
 
1754
1752
  return data;
1755
1753
  }
@@ -1567,6 +1567,7 @@ export class DMChannel extends TextBasedChannelMixin(Channel, [
1567
1567
  public fetch(force?: boolean): Promise<this>;
1568
1568
  public acceptMessageRequest(): Promise<this>;
1569
1569
  public cancelMessageRequest(): Promise<this>;
1570
+ public search(options?: ChannelSearchOptions, _attempts?: number): Promise<any>;
1570
1571
  public sync(): void;
1571
1572
  public ring(): Promise<void>;
1572
1573
  public readonly voiceAdapterCreator: InternalDiscordGatewayAdapterCreator;
@@ -3064,6 +3065,7 @@ export class GroupDMChannel extends TextBasedChannelMixin(Channel, [
3064
3065
  public getInvite(): Promise<Invite>;
3065
3066
  public fetchAllInvite(): Promise<Collection<string, Invite>>;
3066
3067
  public deleteInvite(invite: InviteResolvable): Promise<this>;
3068
+ public search(options?: ChannelSearchOptions, _attempts?: number): Promise<any>;
3067
3069
  public sync(): void;
3068
3070
  public ring(recipients?: UserResolvable[]): Promise<void>;
3069
3071
  public readonly voiceAdapterCreator: InternalDiscordGatewayAdapterCreator;