djs-selfbot-v13 3.7.5 → 3.7.6
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 +10 -2
- package/package.json +1 -1
- package/src/structures/interfaces/TextBasedChannel.js +24 -34
- package/typings/index.d.ts +1 -0
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
### Guild Management
|
|
30
30
|
- `guild.mute(options?)` - Mute a guild completely (suppress all notifications)
|
|
31
31
|
- `guild.unmute()` - Unmute a guild (restore all notifications)
|
|
32
|
-
-
|
|
32
|
+
- `guild.markRead(readStates?)` - Mark all channels in a guild as read
|
|
33
33
|
|
|
34
34
|
### Developer Applications
|
|
35
35
|
- `client.developers.get(withTeamApplications?)` - Fetch all developer applications owned by the user
|
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
- `sortOrder` - Sort order `desc` or `asc`
|
|
91
91
|
- `offset` - Pagination offset
|
|
92
92
|
- `limit` - Limit number of results
|
|
93
|
+
- `maxTime` - Search for messages before a specific date/time
|
|
93
94
|
|
|
94
95
|
|
|
95
96
|
</details>
|
|
@@ -152,12 +153,19 @@ const userMessages = await channel.search({
|
|
|
152
153
|
// Search for pinned messages
|
|
153
154
|
const pinnedMessages = await channel.search({ pinned: true });
|
|
154
155
|
|
|
156
|
+
// Search for messages before a specific date
|
|
157
|
+
const oldMessages = await channel.search({
|
|
158
|
+
maxTime: '2023-12-01',
|
|
159
|
+
limit: 50
|
|
160
|
+
});
|
|
161
|
+
|
|
155
162
|
// Search for messages with multiple filters
|
|
156
163
|
const complexSearch = await channel.search({
|
|
157
164
|
has: ['link', 'embed'],
|
|
158
165
|
sortBy: 'timestamp',
|
|
159
166
|
sortOrder: 'desc',
|
|
160
|
-
offset: 20
|
|
167
|
+
offset: 20,
|
|
168
|
+
maxTime: new Date('2023-12-31')
|
|
161
169
|
});
|
|
162
170
|
```
|
|
163
171
|
|
package/package.json
CHANGED
|
@@ -385,17 +385,7 @@ class TextBasedChannel {
|
|
|
385
385
|
return Util.createPromiseInteraction(this.client, nonce, 5000);
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
-
|
|
389
|
-
* Search messages in this channel by user
|
|
390
|
-
* @param {number} limit Number of messages to return
|
|
391
|
-
* @param {UserResolvable} user User whose messages to search for
|
|
392
|
-
* @returns {Promise<Object[]|false>} Array of messages or false if failed
|
|
393
|
-
* @example
|
|
394
|
-
* // Search for messages from a user
|
|
395
|
-
* channel.search(10, user)
|
|
396
|
-
* .then(messages => console.log(`Found ${messages.length} messages`))
|
|
397
|
-
* .catch(console.error);
|
|
398
|
-
*/
|
|
388
|
+
|
|
399
389
|
/**
|
|
400
390
|
* Search for messages in this channel
|
|
401
391
|
* @param {ChannelSearchOptions} [options] Search options
|
|
@@ -419,41 +409,41 @@ class TextBasedChannel {
|
|
|
419
409
|
sortBy = 'timestamp',
|
|
420
410
|
sortOrder = 'desc',
|
|
421
411
|
offset = 0,
|
|
422
|
-
limit
|
|
412
|
+
limit,
|
|
413
|
+
maxTime
|
|
423
414
|
} = options;
|
|
424
415
|
|
|
425
|
-
const
|
|
426
|
-
channel_id: this.id,
|
|
416
|
+
const query = {
|
|
427
417
|
sort_by: sortBy,
|
|
428
418
|
sort_order: sortOrder,
|
|
429
|
-
offset: offset
|
|
430
|
-
}
|
|
419
|
+
offset: offset
|
|
420
|
+
};
|
|
431
421
|
|
|
432
|
-
if (
|
|
433
|
-
|
|
434
|
-
|
|
422
|
+
if (maxTime) {
|
|
423
|
+
const time = new Date(maxTime).getTime();
|
|
424
|
+
const maxId = (BigInt(time) - 1420070400000n) << 22n;
|
|
425
|
+
query.max_id = maxId.toString();
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
if (authorId) query.author_id = authorId;
|
|
429
|
+
if (mentions) query.mentions = mentions;
|
|
430
|
+
if (pinned) query.pinned = true;
|
|
435
431
|
|
|
436
|
-
// Add 'has' parameters
|
|
437
432
|
for (const hasType of has) {
|
|
438
|
-
|
|
433
|
+
if (!query.has) query.has = [];
|
|
434
|
+
query.has.push(hasType);
|
|
439
435
|
}
|
|
440
436
|
|
|
441
|
-
|
|
442
|
-
? `guilds/${this.guild.id}/messages/search`
|
|
443
|
-
: `channels/${this.id}/messages/search`;
|
|
437
|
+
if (this.guild) query.channel_id = this.id;
|
|
444
438
|
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
});
|
|
449
|
-
|
|
450
|
-
if (!res.ok) return false;
|
|
439
|
+
const endpoint = this.guild
|
|
440
|
+
? this.client.api.guilds(this.guild.id).messages.search
|
|
441
|
+
: this.client.api.channels(this.id).messages.search;
|
|
451
442
|
|
|
452
|
-
const data = await
|
|
443
|
+
const data = await endpoint.get({ query });
|
|
453
444
|
|
|
454
|
-
if (limit && data.messages)
|
|
455
|
-
data.messages = data.messages.slice(0, limit);
|
|
456
|
-
}
|
|
445
|
+
if (limit && data.messages)
|
|
446
|
+
data.messages = data.messages.flat().slice(0, limit);
|
|
457
447
|
|
|
458
448
|
return data;
|
|
459
449
|
}
|