Skip to content

Confused on how Cache & HTTP interact #2365

Answered by arqunis
thetayloredman asked this question in Q&A
Discussion options

You must be logged in to vote

Message::member accepts a parameter that implements CacheHttp, or in other words, a type that can provide access to the http client and/or cache. This trait is used wherever a function needs the http client, but may optionally use the cache first if it is given one. Right now, by passing &ctx.http, you're providing Message::member only the http client. You want to pass a reference to the Context instead: msg.member(ctx) (assuming ctx is &Context), as the Context stores both the http client and cache. This way, Message::member will try searching the cache for the message author's member data first before attempting a http request.

...that's not your problem, though. Your error originates f…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@thetayloredman
Comment options

Answer selected by thetayloredman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants