djs-selfbot-v13 3.7.13 → 3.7.15
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
|
@@ -466,10 +466,10 @@ class ClientUser extends User {
|
|
|
466
466
|
|
|
467
467
|
// Get current widgets first
|
|
468
468
|
const currentWidgets = await this.widgetsList();
|
|
469
|
-
|
|
469
|
+
|
|
470
470
|
// Find existing widget of this type or create new one
|
|
471
471
|
let targetWidget = currentWidgets.widgets.find(w => w.data.type === type);
|
|
472
|
-
|
|
472
|
+
|
|
473
473
|
if (!targetWidget) {
|
|
474
474
|
// Create new widget if it doesn't exist
|
|
475
475
|
targetWidget = {
|
|
@@ -488,7 +488,7 @@ class ClientUser extends User {
|
|
|
488
488
|
const gameData = { game_id: gameId };
|
|
489
489
|
if (comment !== null) gameData.comment = comment;
|
|
490
490
|
if (tags.length > 0) gameData.tags = tags;
|
|
491
|
-
|
|
491
|
+
|
|
492
492
|
targetWidget.data.games.push(gameData);
|
|
493
493
|
}
|
|
494
494
|
|
|
@@ -516,7 +516,7 @@ class ClientUser extends User {
|
|
|
516
516
|
|
|
517
517
|
// Get current widgets
|
|
518
518
|
const currentWidgets = await this.widgetsList();
|
|
519
|
-
|
|
519
|
+
|
|
520
520
|
if (gameId) {
|
|
521
521
|
// Remove specific game from widget
|
|
522
522
|
const targetWidget = currentWidgets.widgets.find(w => w.data.type === type);
|
|
@@ -611,7 +611,7 @@ class ClientUser extends User {
|
|
|
611
611
|
|
|
612
612
|
const primaryColor = resolveColor(color1);
|
|
613
613
|
const colors = [primaryColor];
|
|
614
|
-
|
|
614
|
+
|
|
615
615
|
if (color2 !== null) {
|
|
616
616
|
const secondaryColor = resolveColor(color2);
|
|
617
617
|
colors.push(secondaryColor);
|
|
@@ -629,6 +629,44 @@ class ClientUser extends User {
|
|
|
629
629
|
return this;
|
|
630
630
|
}
|
|
631
631
|
|
|
632
|
+
/**
|
|
633
|
+
* Search messages across all DMs/GDMs using the tabs API.
|
|
634
|
+
* Supports pagination via offset.
|
|
635
|
+
* @param {Object} [options] Search options
|
|
636
|
+
* @param {string} [options.sortBy='timestamp'] Sort by ('timestamp' or 'relevance')
|
|
637
|
+
* @param {string} [options.sortOrder='desc'] Sort order ('asc' or 'desc')
|
|
638
|
+
* @param {number} [options.offset=0] Pagination offset
|
|
639
|
+
* @param {number} [options.limit=25] Results per page (max 25)
|
|
640
|
+
* @param {boolean} [options.trackExactTotal=true] Track exact total hits
|
|
641
|
+
* @returns {Promise<{ messages: Message[], total_results: number }>}
|
|
642
|
+
*/
|
|
643
|
+
async searchTab(options = {}) {
|
|
644
|
+
const {
|
|
645
|
+
sortBy = 'timestamp',
|
|
646
|
+
sortOrder = 'desc',
|
|
647
|
+
offset = 0,
|
|
648
|
+
limit = 25,
|
|
649
|
+
trackExactTotal = true,
|
|
650
|
+
} = options;
|
|
651
|
+
|
|
652
|
+
const data = await this.client.api.users['@me'].messages.search.tabs.post({
|
|
653
|
+
data: {
|
|
654
|
+
tabs: {
|
|
655
|
+
messages: {
|
|
656
|
+
sort_by: sortBy,
|
|
657
|
+
sort_order: sortOrder,
|
|
658
|
+
author_id: [this.id],
|
|
659
|
+
offset,
|
|
660
|
+
limit: Math.min(limit, 25),
|
|
661
|
+
},
|
|
662
|
+
},
|
|
663
|
+
track_exact_total_hits: trackExactTotal,
|
|
664
|
+
},
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
return data;
|
|
668
|
+
}
|
|
669
|
+
|
|
632
670
|
/**
|
|
633
671
|
* Set the TAG of a guild.
|
|
634
672
|
* @param {GuildIDResolve} guild The guild with the tag
|
|
@@ -637,7 +675,7 @@ class ClientUser extends User {
|
|
|
637
675
|
setClan(guild) {
|
|
638
676
|
const id = this.client.guilds.resolveId(guild);
|
|
639
677
|
if (!id) throw new TypeError('INVALID_TYPE', 'guild', 'GuildResolvable');
|
|
640
|
-
|
|
678
|
+
|
|
641
679
|
return this.client.api.users['@me'].clan.put({ data: { identity_guild_id: id, identity_enabled: true } });
|
|
642
680
|
}
|
|
643
681
|
|
|
@@ -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
|
}
|
package/src/structures/Guild.js
CHANGED
|
@@ -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
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -1034,6 +1034,7 @@ export class ClientUser extends User {
|
|
|
1034
1034
|
public delWidget(type: WidgetType, gameId?: string): Promise<any>;
|
|
1035
1035
|
public widgetsList(): Promise<WidgetsResponse>;
|
|
1036
1036
|
public setNameStyle(fontName: FontName | number, effectName: EffectName | number, color1: number | string, color2?: number | string | null): Promise<this>;
|
|
1037
|
+
public searchTab(options?: UserMessageSearchTabOptions): Promise<{ messages: any[][]; total_results: number }>;
|
|
1037
1038
|
}
|
|
1038
1039
|
|
|
1039
1040
|
export class Options extends null {
|
|
@@ -1567,6 +1568,7 @@ export class DMChannel extends TextBasedChannelMixin(Channel, [
|
|
|
1567
1568
|
public fetch(force?: boolean): Promise<this>;
|
|
1568
1569
|
public acceptMessageRequest(): Promise<this>;
|
|
1569
1570
|
public cancelMessageRequest(): Promise<this>;
|
|
1571
|
+
public search(options?: ChannelSearchOptions, _attempts?: number): Promise<any>;
|
|
1570
1572
|
public sync(): void;
|
|
1571
1573
|
public ring(): Promise<void>;
|
|
1572
1574
|
public readonly voiceAdapterCreator: InternalDiscordGatewayAdapterCreator;
|
|
@@ -1722,6 +1724,14 @@ export class Guild extends AnonymousGuild {
|
|
|
1722
1724
|
public search(options?: GuildSearchOptions): Promise<any>;
|
|
1723
1725
|
}
|
|
1724
1726
|
|
|
1727
|
+
export interface UserMessageSearchTabOptions {
|
|
1728
|
+
sortBy?: 'timestamp' | 'relevance';
|
|
1729
|
+
sortOrder?: 'desc' | 'asc';
|
|
1730
|
+
offset?: number;
|
|
1731
|
+
limit?: number;
|
|
1732
|
+
trackExactTotal?: boolean;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1725
1735
|
export class GuildAuditLogs<T extends GuildAuditLogsResolvable = 'ALL'> {
|
|
1726
1736
|
private constructor(guild: Guild, data: RawGuildAuditLogData);
|
|
1727
1737
|
private webhooks: Collection<Snowflake, Webhook>;
|
|
@@ -3064,6 +3074,7 @@ export class GroupDMChannel extends TextBasedChannelMixin(Channel, [
|
|
|
3064
3074
|
public getInvite(): Promise<Invite>;
|
|
3065
3075
|
public fetchAllInvite(): Promise<Collection<string, Invite>>;
|
|
3066
3076
|
public deleteInvite(invite: InviteResolvable): Promise<this>;
|
|
3077
|
+
public search(options?: ChannelSearchOptions, _attempts?: number): Promise<any>;
|
|
3067
3078
|
public sync(): void;
|
|
3068
3079
|
public ring(recipients?: UserResolvable[]): Promise<void>;
|
|
3069
3080
|
public readonly voiceAdapterCreator: InternalDiscordGatewayAdapterCreator;
|