#What's the difference between users.fetch() and users.cache.get()?

13 messages · Page 1 of 1 (latest)

dawn pendant
#

I was just wondering, what is the difference between "<client>.users.fetch()" and "<client.users.cache.get()>"?

viscid cedar
#

fetch runs an API call, cache doesnt. With users it is safer to use fetch, because most of them wont be in the cache

dawn pendant
zealous lark
#

note that fetch returns a Promise

dawn pendant
zealous lark
#

🤨

#

why would it

dawn pendant
#

Doesn't .cache return a collection?

zealous lark
#

yes, cache

#

get() is a Collection method

dawn pendant
#

OHH

zealous lark
#

takes key, returns the element under that key (or undefined if no key)

dawn pendant
#

Why didn't I think about that