feat(MessageManager): Add offset
and limit
(search method)
This commit is contained in:
parent
600df364f4
commit
84aa682bf6
@ -1 +0,0 @@
|
|||||||
update soon ~
|
|
@ -81,7 +81,7 @@ const w = new Discord.WebEmbed({
|
|||||||
.setDescription('description uh')
|
.setDescription('description uh')
|
||||||
.setProvider({ name: 'provider', url: 'https://google.com' })
|
.setProvider({ name: 'provider', url: 'https://google.com' })
|
||||||
.setTitle('This is Title')
|
.setTitle('This is Title')
|
||||||
.setURL('https://google.com')
|
.setURL('https://google.com')
|
||||||
.setImage(
|
.setImage(
|
||||||
'https://cdn.discordapp.com/attachments/820557032016969751/959093026695835648/unknown.png',
|
'https://cdn.discordapp.com/attachments/820557032016969751/959093026695835648/unknown.png',
|
||||||
)
|
)
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
### <strong>I don't take any responsibility for blocked Discord accounts that used this module.</strong>
|
### <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>
|
### <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>[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>
|
### <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",
|
"name": "discord.js-selfbot-v13",
|
||||||
"version": "2.3.8",
|
"version": "2.3.81",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "discord.js-selfbot-v13",
|
"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]",
|
"description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]",
|
||||||
"main": "./src/index.js",
|
"main": "./src/index.js",
|
||||||
"types": "./typings/index.d.ts",
|
"types": "./typings/index.d.ts",
|
||||||
|
@ -254,6 +254,8 @@ class MessageManager extends CachedManager {
|
|||||||
* @property {boolean} [pinned] Whether to filter by pinned messages
|
* @property {boolean} [pinned] Whether to filter by pinned messages
|
||||||
* @property {Array<string>} [has] Message has: `link`, `embed`, `file`, `video`, `image`, or `sound`
|
* @property {Array<string>} [has] Message has: `link`, `embed`, `file`, `video`, `image`, or `sound`
|
||||||
* @property {boolean} [nsfw=false] Whether to filter by NSFW channels
|
* @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}
|
* @returns {MessageSearchResult}
|
||||||
*/
|
*/
|
||||||
async search(options = {}) {
|
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: [],
|
author: [],
|
||||||
content: '',
|
content: '',
|
||||||
@ -279,6 +281,8 @@ class MessageManager extends CachedManager {
|
|||||||
channelId: [],
|
channelId: [],
|
||||||
pinned: false,
|
pinned: false,
|
||||||
nsfw: false,
|
nsfw: false,
|
||||||
|
offset: 0,
|
||||||
|
limit: 25,
|
||||||
},
|
},
|
||||||
options,
|
options,
|
||||||
);
|
);
|
||||||
@ -293,6 +297,8 @@ class MessageManager extends CachedManager {
|
|||||||
if (maxId) stringQuery.push(`max_id=${maxId}`);
|
if (maxId) stringQuery.push(`max_id=${maxId}`);
|
||||||
if (minId) stringQuery.push(`min_id=${minId}`);
|
if (minId) stringQuery.push(`min_id=${minId}`);
|
||||||
if (nsfw) stringQuery.push('include_nsfw=true');
|
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) {
|
if (this.channel.guildId && channelId.length > 0) {
|
||||||
stringQuery.push(channelId.map(id => `channel_id=${id}`).join('&'));
|
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[];
|
channelId: Snowflake[];
|
||||||
pinned: boolean;
|
pinned: boolean;
|
||||||
nsfw: boolean;
|
nsfw: boolean;
|
||||||
|
offset: number;
|
||||||
|
limit: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MessageSearchResult {
|
export interface MessageSearchResult {
|
||||||
|
Loading…
Reference in New Issue
Block a user