mirror of
https://github.com/danbulant/discord.js
synced 2026-06-19 14:41:36 +00:00
Webpack build for branch master: 7f8cc9c297
This commit is contained in:
parent
df0211d7b5
commit
c841f6e0ac
2 changed files with 26 additions and 17 deletions
|
|
@ -5902,7 +5902,7 @@ class Guild {
|
|||
* Performs a search within the entire guild.
|
||||
* <warn>This is only available when using a user account.</warn>
|
||||
* @param {MessageSearchOptions} [options={}] Options to pass to the search
|
||||
* @returns {Promise<Array<Message[]>>}
|
||||
* @returns {Promise<MessageSearchResult>}
|
||||
* An array containing arrays of messages. Each inner array is a search context cluster.
|
||||
* The message which has triggered the result will have the `hit` property set to `true`.
|
||||
* @example
|
||||
|
|
@ -5910,8 +5910,8 @@ class Guild {
|
|||
* content: 'discord.js',
|
||||
* before: '2016-11-17'
|
||||
* }).then(res => {
|
||||
* const hit = res.messages[0].find(m => m.hit).content;
|
||||
* console.log(`I found: **${hit}**, total results: ${res.totalResults}`);
|
||||
* const hit = res.results[0].find(m => m.hit).content;
|
||||
* console.log(`I found: **${hit}**, total results: ${res.total}`);
|
||||
* }).catch(console.error);
|
||||
*/
|
||||
search(options = {}) {
|
||||
|
|
@ -8083,7 +8083,7 @@ class TextBasedChannel {
|
|||
* Performs a search within the channel.
|
||||
* <warn>This is only available when using a user account.</warn>
|
||||
* @param {MessageSearchOptions} [options={}] Options to pass to the search
|
||||
* @returns {Promise<Array<Message[]>>}
|
||||
* @returns {Promise<MessageSearchResult>}
|
||||
* An array containing arrays of messages. Each inner array is a search context cluster
|
||||
* The message which has triggered the result will have the `hit` property set to `true`
|
||||
* @example
|
||||
|
|
@ -8091,8 +8091,8 @@ class TextBasedChannel {
|
|||
* content: 'discord.js',
|
||||
* before: '2016-11-17'
|
||||
* }).then(res => {
|
||||
* const hit = res.messages[0].find(m => m.hit).content;
|
||||
* console.log(`I found: **${hit}**, total results: ${res.totalResults}`);
|
||||
* const hit = res.results[0].find(m => m.hit).content;
|
||||
* console.log(`I found: **${hit}**, total results: ${res.total}`);
|
||||
* }).catch(console.error);
|
||||
*/
|
||||
search(options = {}) {
|
||||
|
|
@ -25792,7 +25792,7 @@ const long = __webpack_require__(33);
|
|||
* @property {UserResolvable} [author] Author to limit search
|
||||
* @property {string} [authorType] One of `user`, `bot`, `webhook`, or add `-` to negate (e.g. `-webhook`)
|
||||
* @property {string} [sortBy='recent'] `recent` or `relevant`
|
||||
* @property {string} [sortOrder='desc'] `asc` or `desc`
|
||||
* @property {string} [sortOrder='descending'] `ascending` or `descending`
|
||||
* @property {number} [contextSize=2] How many messages to get around the matched message (0 to 2)
|
||||
* @property {number} [limit=25] Maximum number of results to get (1 to 25)
|
||||
* @property {number} [offset=0] Offset the "pages" of results (since you can only see 25 at a time)
|
||||
|
|
@ -25800,7 +25800,7 @@ const long = __webpack_require__(33);
|
|||
* @property {boolean} [mentionsEveryone] If everyone is mentioned
|
||||
* @property {string} [linkHostname] Filter links by hostname
|
||||
* @property {string} [embedProvider] The name of an embed provider
|
||||
* @property {string} [embedType] one of `image`, `video`, `url`, `rich`
|
||||
* @property {string} [embedType] one of `image`, `video`, `url`, `rich`, or add `-` to negate (e.g. `-image`)
|
||||
* @property {string} [attachmentFilename] The name of an attachment
|
||||
* @property {string} [attachmentExtension] The extension of an attachment
|
||||
* @property {Date} [before] Date to find messages before
|
||||
|
|
@ -25809,6 +25809,12 @@ const long = __webpack_require__(33);
|
|||
* @property {boolean} [nsfw=false] Include results from NSFW channels
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} MessageSearchResult
|
||||
* @type {number} total Total result count
|
||||
* @type {Array<Message[]>} results Array of message results
|
||||
*/
|
||||
|
||||
module.exports = function search(target, options) {
|
||||
if (typeof options === 'string') options = { content: options };
|
||||
if (options.before) {
|
||||
|
|
@ -25823,11 +25829,14 @@ module.exports = function search(target, options) {
|
|||
if (!(options.during instanceof Date)) options.during = new Date(options.during);
|
||||
const t = options.during.getTime() - 14200704e5;
|
||||
options.minID = long.fromNumber(t).shiftLeft(22).toString();
|
||||
options.maxID = long.fromNumber(t + 86400000).shiftLeft(22).toString();
|
||||
options.maxID = long.fromNumber(t + 864e5).shiftLeft(22).toString();
|
||||
}
|
||||
if (options.channel) options.channel = target.client.resolver.resolveChannelID(options.channel);
|
||||
if (options.author) options.author = target.client.resolver.resolveUserID(options.author);
|
||||
if (options.mentions) options.mentions = target.client.resolver.resolveUserID(options.options.mentions);
|
||||
if (options.sortOrder) {
|
||||
options.sortOrder = { ascending: 'asc', descending: 'desc' }[options.sortOrder] || options.sortOrder;
|
||||
}
|
||||
options = {
|
||||
content: options.content,
|
||||
max_id: options.maxID,
|
||||
|
|
@ -25862,12 +25871,12 @@ module.exports = function search(target, options) {
|
|||
|
||||
let endpoint = target.client.api[target instanceof Channel ? 'channels' : 'guilds'](target.id).messages().search;
|
||||
return endpoint.get({ query: options }).then(body => {
|
||||
const messages = body.messages.map(x =>
|
||||
const results = body.messages.map(x =>
|
||||
x.map(m => new Message(target.client.channels.get(m.channel_id), m, target.client))
|
||||
);
|
||||
return {
|
||||
totalResults: body.total_results,
|
||||
messages,
|
||||
total: body.total_results,
|
||||
results,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
10
discord.master.min.js
vendored
10
discord.master.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue