@@ -192,7 +192,7 @@ def get(client: "Client", obj: Type[_T], **kwargs) -> Optional[_T]:
192192 http_name = f"get_{ _obj .__name__ .lower ()} "
193193 kwarg_name = f"{ _obj .__name__ .lower ()} _ids"
194194 _objects : List [Union [_obj , Coroutine ]] = (
195- _get_cache (_obj , client , kwarg_name , _list = True , ** kwargs ) if force_http else []
195+ _get_cache (_obj , client , kwarg_name , _list = True , ** kwargs ) if not force_http else []
196196 ) # some sourcery stuff i dunno
197197
198198 if force_cache :
@@ -227,7 +227,7 @@ def get(client: "Client", obj: Type[_T], **kwargs) -> Optional[_T]:
227227 kwarg_name = f"{ obj .__name__ .lower ()} _id"
228228
229229 _obj : Optional [_T ] = (
230- None if force_http else _get_cache (obj , client , kwarg_name , ** kwargs )
230+ _get_cache (obj , client , kwarg_name , ** kwargs ) if not force_http else None
231231 ) # more sourcery stuff
232232
233233 if force_cache :
@@ -277,7 +277,7 @@ def _get_cache(
277277 _object : Type [_T ], client : "Client" , kwarg_name : str , _list : bool = False , ** kwargs
278278) -> Union [Optional [_T ], List [Optional [_T ]]]:
279279 if _list :
280- _obj = []
280+ _objs = []
281281 if _object == Member : # Can't be more dynamic on this
282282 _guild_id = Snowflake (kwargs .get ("guild_id" ))
283283 _values = [
@@ -287,13 +287,19 @@ def _get_cache(
287287 )
288288 for _id in kwargs .get ("member_ids" )
289289 ]
290- _obj .extend (client ._http .cache [_object ].get (item , None ) for item in _values )
290+ for item in _values :
291+ _obj = client ._http .cache [_object ].get (item , None )
292+ if _obj :
293+ _obj ._client = client ._http
294+ _objs .append (_obj )
291295
292296 else :
293- _obj .extend (
294- client ._http .cache [_object ].get (Snowflake (_id ), None )
295- for _id in kwargs .get (kwarg_name )
296- )
297+ for _id in kwargs .get (kwarg_name ):
298+ _obj = client ._http .cache [_object ].get (Snowflake (_id ), None )
299+ if _obj :
300+ _obj ._client = client ._http
301+ _objs .append (_obj )
302+ return _objs
297303 else :
298304 if _object == Member :
299305 _values = (
@@ -304,7 +310,9 @@ def _get_cache(
304310 _values = Snowflake (kwargs .get (kwarg_name ))
305311
306312 _obj = client ._http .cache [_object ].get (_values )
307- return _obj
313+ if _obj :
314+ _obj ._client = client ._http
315+ return _obj
308316
309317
310318def _resolve_kwargs (obj , ** kwargs ):
0 commit comments