refactor: fetch options consistency (#5824)

This commit is contained in:
ckohen
2021-06-12 04:10:35 -07:00
committed by GitHub
parent 08cffd6a30
commit 7111b4cd5f
10 changed files with 28 additions and 49 deletions

View File

@@ -46,8 +46,7 @@ class MessageManager extends BaseManager {
* <info>The returned Collection does not contain reaction users of the messages if they were not cached.
* Those need to be fetched separately in such a case.</info>
* @param {Snowflake|ChannelLogsQueryOptions} [message] The ID of the message to fetch, or query parameters.
* @param {boolean} [cache=true] Whether to cache the message(s)
* @param {boolean} [force=false] Whether to skip the cache check and request the API
* @param {BaseFetchOptions} [options] Additional options for this fetch
* @returns {Promise<Message>|Promise<Collection<Snowflake, Message>>}
* @example
* // Get message
@@ -65,7 +64,7 @@ class MessageManager extends BaseManager {
* .then(messages => console.log(`${messages.filter(m => m.author.id === '84484653687267328').size} messages`))
* .catch(console.error);
*/
fetch(message, cache = true, force = false) {
fetch(message, { cache = true, force = false } = {}) {
return typeof message === 'string' ? this._fetchId(message, cache, force) : this._fetchMany(message, cache);
}