djs-selfbot-v13 3.7.6 → 3.7.7
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 +17 -0
- package/package.json +1 -1
- package/src/structures/Guild.js +64 -0
- package/typings/index.d.ts +14 -0
package/README.md
CHANGED
|
@@ -92,6 +92,10 @@
|
|
|
92
92
|
- `limit` - Limit number of results
|
|
93
93
|
- `maxTime` - Search for messages before a specific date/time
|
|
94
94
|
|
|
95
|
+
- `guild.search(options?)` - Search for messages across the entire guild with advanced filters
|
|
96
|
+
- `channelId` - Search in a specific channel within the guild
|
|
97
|
+
- All other options same as `channel.search()`
|
|
98
|
+
|
|
95
99
|
|
|
96
100
|
</details>
|
|
97
101
|
|
|
@@ -167,6 +171,19 @@ const complexSearch = await channel.search({
|
|
|
167
171
|
offset: 20,
|
|
168
172
|
maxTime: new Date('2023-12-31')
|
|
169
173
|
});
|
|
174
|
+
|
|
175
|
+
// Guild-wide search for messages in a specific channel
|
|
176
|
+
const guildChannelSearch = await guild.search({
|
|
177
|
+
channelId: '123456789012345678',
|
|
178
|
+
authorId: '987654321098765432',
|
|
179
|
+
has: ['image']
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// Guild-wide search across all channels
|
|
183
|
+
const guildWideSearch = await guild.search({
|
|
184
|
+
has: ['video'],
|
|
185
|
+
limit: 100
|
|
186
|
+
});
|
|
170
187
|
```
|
|
171
188
|
|
|
172
189
|
#### Guild Read State Management
|
package/package.json
CHANGED
package/src/structures/Guild.js
CHANGED
|
@@ -1690,6 +1690,70 @@ class Guild extends AnonymousGuild {
|
|
|
1690
1690
|
return data;
|
|
1691
1691
|
}
|
|
1692
1692
|
|
|
1693
|
+
/**
|
|
1694
|
+
* Search for messages in this guild
|
|
1695
|
+
* @param {GuildSearchOptions} [options] Search options
|
|
1696
|
+
* @returns {Promise<Object>} The search results
|
|
1697
|
+
* @example
|
|
1698
|
+
* // Search for messages in a specific channel
|
|
1699
|
+
* guild.search({ channelId: '123456789012345678' });
|
|
1700
|
+
*
|
|
1701
|
+
* // Search for messages by author in a channel
|
|
1702
|
+
* guild.search({
|
|
1703
|
+
* channelId: '123456789012345678',
|
|
1704
|
+
* authorId: '987654321098765432'
|
|
1705
|
+
* });
|
|
1706
|
+
*
|
|
1707
|
+
* // Search for messages with images across the guild
|
|
1708
|
+
* guild.search({ has: ['image'] });
|
|
1709
|
+
*/
|
|
1710
|
+
async search(options = {}) {
|
|
1711
|
+
const {
|
|
1712
|
+
channelId,
|
|
1713
|
+
authorId,
|
|
1714
|
+
mentions,
|
|
1715
|
+
has = [],
|
|
1716
|
+
pinned,
|
|
1717
|
+
sortBy = 'timestamp',
|
|
1718
|
+
sortOrder = 'desc',
|
|
1719
|
+
offset = 0,
|
|
1720
|
+
limit,
|
|
1721
|
+
maxTime
|
|
1722
|
+
} = options;
|
|
1723
|
+
|
|
1724
|
+
const query = {
|
|
1725
|
+
sort_by: sortBy,
|
|
1726
|
+
sort_order: sortOrder,
|
|
1727
|
+
offset: offset
|
|
1728
|
+
};
|
|
1729
|
+
|
|
1730
|
+
if (channelId) query.channel_id = channelId;
|
|
1731
|
+
if (authorId) query.author_id = authorId;
|
|
1732
|
+
if (mentions) query.mentions = mentions;
|
|
1733
|
+
if (pinned) query.pinned = true;
|
|
1734
|
+
|
|
1735
|
+
if (maxTime) {
|
|
1736
|
+
const time = new Date(maxTime).getTime();
|
|
1737
|
+
const maxId = (BigInt(time) - 1420070400000n) << 22n;
|
|
1738
|
+
query.max_id = maxId.toString();
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
// Add 'has' parameters
|
|
1742
|
+
for (const hasType of has) {
|
|
1743
|
+
if (!query.has) query.has = [];
|
|
1744
|
+
query.has.push(hasType);
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
const data = await this.client.api.guilds(this.id).messages.search.get({ query });
|
|
1748
|
+
|
|
1749
|
+
if (limit && data.messages) {
|
|
1750
|
+
// data.messages est souvent un tableau de tableaux dans l'API search
|
|
1751
|
+
data.messages = data.messages.flat().slice(0, limit);
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
return data;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1693
1757
|
/**
|
|
1694
1758
|
* Creates a collection of this guild's roles, sorted by their position and ids.
|
|
1695
1759
|
* @returns {Collection<Snowflake, Role>}
|
package/typings/index.d.ts
CHANGED
|
@@ -963,6 +963,19 @@ export interface MarkReadOptions {
|
|
|
963
963
|
read_state_type?: number;
|
|
964
964
|
}
|
|
965
965
|
|
|
966
|
+
export interface GuildSearchOptions {
|
|
967
|
+
channelId?: Snowflake;
|
|
968
|
+
authorId?: Snowflake;
|
|
969
|
+
mentions?: Snowflake;
|
|
970
|
+
has?: ('image' | 'video' | 'link' | 'embed' | 'sound' | 'poll' | 'sticker' | 'snapshot')[];
|
|
971
|
+
pinned?: boolean;
|
|
972
|
+
sortBy?: 'timestamp' | 'relevance';
|
|
973
|
+
sortOrder?: 'desc' | 'asc';
|
|
974
|
+
offset?: number;
|
|
975
|
+
limit?: number;
|
|
976
|
+
maxTime?: string | Date;
|
|
977
|
+
}
|
|
978
|
+
|
|
966
979
|
export type OAuth2AuthorizeOptions = {
|
|
967
980
|
guild_id?: Snowflake;
|
|
968
981
|
permissions?: string;
|
|
@@ -1703,6 +1716,7 @@ export class Guild extends AnonymousGuild {
|
|
|
1703
1716
|
public mute(options?: GuildMuteOptions): Promise<any>;
|
|
1704
1717
|
public unmute(): Promise<any>;
|
|
1705
1718
|
public markRead(readStates?: MarkReadOptions[]): Promise<any>;
|
|
1719
|
+
public search(options?: GuildSearchOptions): Promise<any>;
|
|
1706
1720
|
}
|
|
1707
1721
|
|
|
1708
1722
|
export class GuildAuditLogs<T extends GuildAuditLogsResolvable = 'ALL'> {
|