feat(MessageManager): Add offset
and limit
(search method)
This commit is contained in:
parent
600df364f4
commit
84aa682bf6
@ -1 +0,0 @@
|
||||
update soon ~
|
@ -30,8 +30,6 @@
|
||||
### <strong>I don't take any responsibility for blocked Discord accounts that used this module.</strong>
|
||||
### <strong>Using this on a user account is prohibited by the [Discord TOS](https://discord.com/terms) and can lead to the account block.</strong>
|
||||
|
||||
### Finally the package got 100 stars (GitHub), thank you all 💖
|
||||
|
||||
### <strong>[Document Website (recommend)](https://discordjs-self-v13.netlify.app/)</strong>
|
||||
|
||||
### <strong>[Extend Document (With Example)](https://github.com/aiko-chan-ai/discord.js-selfbot-v13/tree/main/Document)</strong>
|
||||
|
File diff suppressed because one or more lines are too long
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "discord.js-selfbot-v13",
|
||||
"version": "2.3.8",
|
||||
"version": "2.3.81",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "discord.js-selfbot-v13",
|
||||
"version": "2.3.8",
|
||||
"version": "2.3.81",
|
||||
"description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]",
|
||||
"main": "./src/index.js",
|
||||
"types": "./typings/index.d.ts",
|
||||
|
@ -254,6 +254,8 @@ class MessageManager extends CachedManager {
|
||||
* @property {boolean} [pinned] Whether to filter by pinned messages
|
||||
* @property {Array<string>} [has] Message has: `link`, `embed`, `file`, `video`, `image`, or `sound`
|
||||
* @property {boolean} [nsfw=false] Whether to filter by NSFW channels
|
||||
* @property {number} [offset=0] The number of messages to skip (for pagination, 25 results per page)
|
||||
* @property {number} [limit=25] The number of messages to fetch
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -268,7 +270,7 @@ class MessageManager extends CachedManager {
|
||||
* @returns {MessageSearchResult}
|
||||
*/
|
||||
async search(options = {}) {
|
||||
let { author, content, mentions, has, maxId, minId, channelId, pinned, nsfw } = Object.assign(
|
||||
let { author, content, mentions, has, maxId, minId, channelId, pinned, nsfw, offset, limit } = Object.assign(
|
||||
{
|
||||
author: [],
|
||||
content: '',
|
||||
@ -279,6 +281,8 @@ class MessageManager extends CachedManager {
|
||||
channelId: [],
|
||||
pinned: false,
|
||||
nsfw: false,
|
||||
offset: 0,
|
||||
limit: 25,
|
||||
},
|
||||
options,
|
||||
);
|
||||
@ -293,6 +297,8 @@ class MessageManager extends CachedManager {
|
||||
if (maxId) stringQuery.push(`max_id=${maxId}`);
|
||||
if (minId) stringQuery.push(`min_id=${minId}`);
|
||||
if (nsfw) stringQuery.push('include_nsfw=true');
|
||||
if (offset !== 0) stringQuery.push(`offset=${offset}`);
|
||||
if (limit !== 25) stringQuery.push(`limit=${limit}`);
|
||||
if (this.channel.guildId && channelId.length > 0) {
|
||||
stringQuery.push(channelId.map(id => `channel_id=${id}`).join('&'));
|
||||
}
|
||||
|
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@ -3802,6 +3802,8 @@ export interface MessageSearchOptions {
|
||||
channelId: Snowflake[];
|
||||
pinned: boolean;
|
||||
nsfw: boolean;
|
||||
offset: number;
|
||||
limit: number;
|
||||
}
|
||||
|
||||
export interface MessageSearchResult {
|
||||
|
Loading…
Reference in New Issue
Block a user