allow users and members to not be cached (#1097)

This commit is contained in:
Gus Caplan
2017-01-14 15:20:09 -06:00
committed by Amish Shah
parent e216fc7a81
commit 78bf402e8e
3 changed files with 22 additions and 12 deletions

View File

@@ -270,11 +270,12 @@ class Client extends EventEmitter {
* Caches a user, or obtains it from the cache if it's already cached.
* <warn>This is only available when using a bot account.</warn>
* @param {string} id The ID of the user to obtain
* @param {boolean} [cache=true] Insert the user into the users cache
* @returns {Promise<User>}
*/
fetchUser(id) {
fetchUser(id, cache = true) {
if (this.users.has(id)) return Promise.resolve(this.users.get(id));
return this.rest.methods.getUser(id);
return this.rest.methods.getUser(id, cache);
}
/**