Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion interactions/api/models/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class Embed(DictSerializerMixin):

interactions.Embed(
title="Embed title",
fields=[interaction.EmbedField(...)],
fields=[interactions.EmbedField(...)],
)

:ivar Optional[str] title: Title of embed
Expand Down
24 changes: 16 additions & 8 deletions interactions/utils/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def get(client: "Client", obj: Type[_T], **kwargs) -> Optional[_T]:
http_name = f"get_{_obj.__name__.lower()}"
kwarg_name = f"{_obj.__name__.lower()}_ids"
_objects: List[Union[_obj, Coroutine]] = (
_get_cache(_obj, client, kwarg_name, _list=True, **kwargs) if force_http else []
[] if force_http else _get_cache(_obj, client, kwarg_name, _list=True, **kwargs)
) # some sourcery stuff i dunno

if force_cache:
Expand Down Expand Up @@ -277,7 +277,7 @@ def _get_cache(
_object: Type[_T], client: "Client", kwarg_name: str, _list: bool = False, **kwargs
) -> Union[Optional[_T], List[Optional[_T]]]:
if _list:
_obj = []
_objs = []
if _object == Member: # Can't be more dynamic on this
_guild_id = Snowflake(kwargs.get("guild_id"))
_values = [
Expand All @@ -287,13 +287,19 @@ def _get_cache(
)
for _id in kwargs.get("member_ids")
]
_obj.extend(client._http.cache[_object].get(item, None) for item in _values)
for item in _values:
_obj = client._http.cache[_object].get(item, None)
if isinstance(_obj, _object):
_obj._client = client._http
_objs.append(_obj)

else:
_obj.extend(
client._http.cache[_object].get(Snowflake(_id), None)
for _id in kwargs.get(kwarg_name)
)
for _id in kwargs.get(kwarg_name):
_obj = client._http.cache[_object].get(Snowflake(_id), None)
if isinstance(_obj, _object):
_obj._client = client._http
_objs.append(_obj)
return _objs
else:
if _object == Member:
_values = (
Expand All @@ -304,7 +310,9 @@ def _get_cache(
_values = Snowflake(kwargs.get(kwarg_name))

_obj = client._http.cache[_object].get(_values)
return _obj
if isinstance(_obj, _object):
_obj._client = client._http
return _obj


def _resolve_kwargs(obj, **kwargs):
Expand Down