We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BUG] forcing http in get() not working
### Describe the bug.

forcing http in get() function returns the cache if there is one.

### List the steps.

1. get member: `member: interactions.Member = await di.get(client=bot, obj=interactions.Member, parent_id=ctx.guild_id, object_id=ctx.author.id._snowflake, force="http")`
2. Add Role to Member via Discord
3. get member again
4. compare member.role before and after

### What you expected.

The rolelists before/after should have difference

### What you saw.

Instead the rolelists are the same

### What version of the library did you use?

release

### Version specification

_No response_

### Code of Conduct

- [X] I agree to follow the contribution requirements.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `interactions/utils/get.py`
Content:
```
1 from asyncio import sleep
2 from enum import Enum
3 from inspect import isawaitable
4 from logging import getLogger
5 from typing import TYPE_CHECKING, Coroutine, List, Optional, Type, TypeVar, Union, get_args
6 
7 try:
8     from typing import _GenericAlias
9 
10 except ImportError:
11     from typing import _BaseGenericAlias as _GenericAlias
12 
13 from sys import version_info
14 
15 from ..api.error import LibraryException
16 from ..api.models.emoji import Emoji
17 from ..api.models.member import Member
18 from ..api.models.message import Message
19 from ..api.models.misc import Snowflake
20 from ..api.models.role import Role
21 
22 log = getLogger("get")
23 
24 _T = TypeVar("_T")
25 
26 if TYPE_CHECKING:
27     from ..api.http.client import HTTPClient
28     from ..client.bot import Client
29 
30 __all__ = (
31     "get",
32     "Force",
33 )
34 
35 
36 class Force(str, Enum):
37     """
38     An enumerable object representing the force types for the get method.
39 
40     :ivar str CACHE: Enforce the usage of cache and block the usage of http
41     :ivar str HTTP: Enforce the usage of http and block the usage of cache
42     """
43 
44     CACHE = "cache"
45     HTTP = "http"
46 
47 
48 def get(client: "Client", obj: Type[_T], **kwargs) -> Optional[_T]:
49     """
50     Helper method to get an object.
51 
52     This method can do the following:
53         * Get a list of specific objects
54             * purely from cache
55             * purely from HTTP
56             * from cache and additionally from HTTP for every ID that was not found in cache
57         * Get a single specific object
58             * purely from cache
59             * purely from HTTP
60             * from HTTP if not found in cache else from cache
61 
62     The method has to be awaited when:
63         * You don't force anything
64         * You force HTTP
65     The method doesn't have to be awaited when:
66         * You force cache
67 
68     .. note ::
69         Technically, there is no need for an ``await`` if there is an object found in the cache. Because of the fact,
70         that, as long as you don't enforce the cache, the function will get the object from HTTP, if it is not in the
71         cache, you still have to await it. This has been done to reduce confusion on whether the object origins from
72         an HTTP call or a cache result and to remove the extra step for you to check if the returned object is an
73         awaitable or not.
74 
75 
76     Forcing:
77         Forcing can be done via the ``force`` keyword argument.
78             * ``force="cache"`` or ``force=interactions.Force.CACHE``:
79                 This forces the method to only return from cache (if the object is not found it will return ``None``). If
80                 you use this, you don't need to await the method.
81 
82             * ``force="http"`` or ``force=interactions.Force.HTTP``:
83                 This forces the method to make an HTTP request to the discord API and return the result of it. If you
84                 use this, you have to await the method.
85 
86                 .. attention ::
87                     If you are a PyCharm user, please be aware of a bug that causes incorrect suggestions to appear if
88                     using an enum. Even if PyCharm shows a normal object as result, you have to await the method if you
89                     enforce HTTP. To prevent this bug from happening it is suggested using ``force="http"`` instead of
90                     the enum.
91 
92     Getting an object:
93 
94         Here you will see two examples on how to get a single objects and the variations of how the object can be
95         gotten.
96 
97         * Example 1/2: Getting a Channel:
98 
99             .. code-block:: python
100 
101                 # normally
102                 channel = await get(client, interactions.Channel, object_id=your_channel_id)
103                 # always has a value
104 
105                 # with http force
106                 channel = await get(client, interactions.Channel, object_id=your_channel_id, force="http")
107                 # always has a value
108 
109                 # with cache force
110                 channel = get(client, interactions.Channel, object_id=your_channel_id, force="cache")
111                 # because of cache only, this can be None
112 
113 
114         * Example 2/2: Getting a Member:
115 
116             .. code-block:: python
117 
118                 # normally
119                 member = await get(
120                     client, interactions.Member, parent_id=your_guild_id, object_id=your_member_id
121                 )
122                 # always has a value
123 
124                 # with http force
125                 member = await get(
126                     client, interactions.Member, parent_id=your_guild_id, object_id=your_member_id
127                 )
128                 # always has a value
129 
130                 # with cache force
131                 member = await get(
132                     client, interactions.Member, parent_id=your_guild_id, object_id=your_member_id
133                 )
134                 # because of cache only, this can be None
135 
136 
137         Both examples should have given you a basic overview on how to get a single object. Now we will move on with
138         lists of objects.
139 
140         .. important::
141             The ``parent_id`` represents the channel or guild id that belongs to the objects you want to get. It is
142             called ``parent_id`` because ``guild_or_channel_id`` would be horrible to type out every time.
143 
144     Getting a list of an object:
145         Here you will see 1 example of how to get a list of objects. The possibilities on how to force (and their
146         results) are the same as in the examples above.
147 
148         * Example 1/1: Getting a list of members:
149 
150             .. code-block:: python
151 
152                 from typing import List
153 
154                 # you can also use `list[interactions.Member]` if you have python >= 3.9
155 
156                 members = await get(
157                     client,
158                     List[interactions.Member],
159                     parent_id=your_guild_id,
160                     object_ids=[your_member_id1, your_member_id2, ...],
161                 )
162 
163 
164         If you enforce cache when getting a list of objects, found objets will be placed into the list and not found
165         objects will be placed as ``None`` into the list.
166 
167     """
168 
169     if version_info >= (3, 9):
170 
171         def _check():
172             return (
173                 obj == list[get_args(obj)[0]]
174                 if isinstance(get_args(obj), tuple) and get_args(obj)
175                 else False
176             )
177 
178     else:
179 
180         def _check():
181             return False
182 
183     if not isinstance(obj, type) and not isinstance(obj, _GenericAlias):
184         raise LibraryException(message="The object must not be an instance of a class!", code=12)
185 
186     client: "Client"
187     obj: Union[Type[_T], Type[List[_T]]]
188     kwargs = _resolve_kwargs(obj, **kwargs)
189     http_name = f"get_{obj.__name__.lower()}"
190     kwarg_name = f"{obj.__name__.lower()}_id"
191 
192     if isinstance(obj, _GenericAlias) or _check():
193         _obj: Type[_T] = get_args(obj)[0]
194         _objects: List[Union[_obj, Coroutine]] = []
195         kwarg_name += "s"
196 
197         force_cache = kwargs.pop("force", None) == "cache"
198         force_http = kwargs.pop("force", None) == "http"
199 
200         if not force_http:
201             _objects = _get_cache(_obj, client, kwarg_name, _list=True, **kwargs)
202 
203         if force_cache:
204             return _objects
205 
206         elif not force_http and None not in _objects:
207             return _return_cache(_objects)
208 
209         elif force_http:
210             _objects.clear()
211             _func = getattr(client._http, http_name)
212             for _id in kwargs.get(kwarg_name):
213                 _kwargs = kwargs
214                 _kwargs.pop(kwarg_name)
215                 _kwargs[kwarg_name[:-1]] = _id
216                 _objects.append(_func(**_kwargs))
217             return _http_request(_obj, http=client._http, request=_objects)
218 
219         else:
220             _func = getattr(client._http, http_name)
221             for _index, __obj in enumerate(_objects):
222                 if __obj is None:
223                     _id = kwargs.get(kwarg_name)[_index]
224                     _kwargs = kwargs
225                     _kwargs.pop(kwarg_name)
226                     _kwargs[kwarg_name[:-1]] = _id
227                     _request = _func(**_kwargs)
228                     _objects[_index] = _request
229             return _http_request(_obj, http=client._http, request=_objects)
230 
231     _obj: Optional[_T] = None
232 
233     force_cache = kwargs.pop("force", None) == "cache"
234     force_http = kwargs.pop("force", None) == "http"
235     if not force_http:
236         _obj = _get_cache(obj, client, kwarg_name, **kwargs)
237 
238     if force_cache:
239         return _obj
240 
241     elif not force_http and _obj:
242         return _return_cache(_obj)
243 
244     else:
245         return _http_request(obj=obj, http=client._http, _name=http_name, **kwargs)
246 
247 
248 async def _http_request(
249     obj: Type[_T],
250     http: "HTTPClient",
251     request: Union[Coroutine, List[Union[_T, Coroutine]], List[Coroutine]] = None,
252     _name: str = None,
253     **kwargs,
254 ) -> Union[_T, List[_T]]:
255     if not request:
256         if obj in (Role, Emoji):
257             from ..api.models.guild import Guild
258 
259             _guild = Guild(**await http.get_guild(kwargs.pop("guild_id")), _client=http)
260             _func = getattr(_guild, _name)
261             return await _func(**kwargs)
262 
263         _func = getattr(http, _name)
264         _obj = await _func(**kwargs)
265         return obj(**_obj, _client=http)
266 
267     if not isinstance(request, list):
268         return obj(**await request, _client=http)
269 
270     return [obj(**await req, _client=http) if isawaitable(req) else req for req in request]
271 
272 
273 async def _return_cache(
274     obj: Union[Optional[_T], List[Optional[_T]]]
275 ) -> Union[Optional[_T], List[Optional[_T]]]:
276     await sleep(0)  # iirc Bluenix meant that any coroutine should await at least once
277     return obj
278 
279 
280 def _get_cache(
281     _object: Type[_T], client: "Client", kwarg_name: str, _list: bool = False, **kwargs
282 ) -> Union[Optional[_T], List[Optional[_T]]]:
283     if _list:
284         _obj = []
285         if _object == Member:  # Can't be more dynamic on this
286             _guild_id = Snowflake(kwargs.get("guild_id"))
287             _values = [
288                 (
289                     _guild_id,
290                     Snowflake(_id),
291                 )
292                 for _id in kwargs.get("member_ids")
293             ]
294             _obj.extend(client._http.cache[_object].get(item, None) for item in _values)
295 
296         else:
297             _obj.extend(
298                 client._http.cache[_object].get(Snowflake(_id), None)
299                 for _id in kwargs.get(kwarg_name)
300             )
301     else:
302         if _object == Member:
303             _values = (
304                 Snowflake(kwargs.get("guild_id")),
305                 Snowflake(kwargs.get("member_id")),
306             )  # Fuck it, I can't be dynamic on this
307         else:
308             _values = Snowflake(kwargs.get(kwarg_name))
309 
310         _obj = client._http.cache[_object].get(_values)
311     return _obj
312 
313 
314 def _resolve_kwargs(obj, **kwargs):
315     # This function is needed to get correct kwarg names
316     if __id := kwargs.pop("parent_id", None):
317 
318         if version_info >= (3, 9):
319             _list = [Message, List[Message], list[Message]]
320         else:
321             _list = [Message, List[Message]]
322 
323         kwargs[f"{'channel_id' if obj in _list else 'guild_id'}"] = __id
324 
325     if __id := kwargs.pop("object_id", None):
326         _kwarg_name = f"{obj.__name__.lower()}_id"
327         kwargs[_kwarg_name] = __id
328 
329     elif __id := kwargs.pop("object_ids", None):
330         _kwarg_name = f"{get_args(obj)[0].__name__.lower()}_ids"
331         kwargs[_kwarg_name] = __id
332 
333     else:
334         raise LibraryException(code=12, message="The specified kwargs are invalid!")
335 
336     return kwargs
337
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/interactions/utils/get.py b/interactions/utils/get.py
--- a/interactions/utils/get.py
+++ b/interactions/utils/get.py
@@ -194,8 +194,9 @@
         _objects: List[Union[_obj, Coroutine]] = []
         kwarg_name += "s"
 
-        force_cache = kwargs.pop("force", None) == "cache"
-        force_http = kwargs.pop("force", None) == "http"
+        force_arg = kwargs.pop("force", None)
+        force_cache = force_arg == "cache"
+        force_http = force_arg == "http"
 
         if not force_http:
             _objects = _get_cache(_obj, client, kwarg_name, _list=True, **kwargs)
@@ -230,8 +231,10 @@
 
     _obj: Optional[_T] = None
 
-    force_cache = kwargs.pop("force", None) == "cache"
-    force_http = kwargs.pop("force", None) == "http"
+    force_arg = kwargs.pop("force", None)
+    force_cache = force_arg == "cache"
+    force_http = force_arg == "http"
+
     if not force_http:
         _obj = _get_cache(obj, client, kwarg_name, **kwargs)

{"golden_diff": "diff --git a/interactions/utils/get.py b/interactions/utils/get.py\n--- a/interactions/utils/get.py\n+++ b/interactions/utils/get.py\n@@ -194,8 +194,9 @@\n         _objects: List[Union[_obj, Coroutine]] = []\n         kwarg_name += \"s\"\n \n-        force_cache = kwargs.pop(\"force\", None) == \"cache\"\n-        force_http = kwargs.pop(\"force\", None) == \"http\"\n+        force_arg = kwargs.pop(\"force\", None)\n+        force_cache = force_arg == \"cache\"\n+        force_http = force_arg == \"http\"\n \n         if not force_http:\n             _objects = _get_cache(_obj, client, kwarg_name, _list=True, **kwargs)\n@@ -230,8 +231,10 @@\n \n     _obj: Optional[_T] = None\n \n-    force_cache = kwargs.pop(\"force\", None) == \"cache\"\n-    force_http = kwargs.pop(\"force\", None) == \"http\"\n+    force_arg = kwargs.pop(\"force\", None)\n+    force_cache = force_arg == \"cache\"\n+    force_http = force_arg == \"http\"\n+\n     if not force_http:\n         _obj = _get_cache(obj, client, kwarg_name, **kwargs)\n", "issue": "[BUG] forcing http in get() not working\n### Describe the bug.\n\nforcing http in get() function returns the cache if there is one.\n\n### List the steps.\n\n1. get member: `member: interactions.Member = await di.get(client=bot, obj=interactions.Member, parent_id=ctx.guild_id, object_id=ctx.author.id._snowflake, force=\"http\")`\r\n2. Add Role to Member via Discord\r\n3. get member again\r\n4. compare member.role before and after\n\n### What you expected.\n\nThe rolelists before/after should have difference\n\n### What you saw.\n\nInstead the rolelists are the same\n\n### What version of the library did you use?\n\nrelease\n\n### Version specification\n\n_No response_\n\n### Code of Conduct\n\n- [X] I agree to follow the contribution requirements.\n", "before_files": [{"content": "from asyncio import sleep\nfrom enum import Enum\nfrom inspect import isawaitable\nfrom logging import getLogger\nfrom typing import TYPE_CHECKING, Coroutine, List, Optional, Type, TypeVar, Union, get_args\n\ntry:\n    from typing import _GenericAlias\n\nexcept ImportError:\n    from typing import _BaseGenericAlias as _GenericAlias\n\nfrom sys import version_info\n\nfrom ..api.error import LibraryException\nfrom ..api.models.emoji import Emoji\nfrom ..api.models.member import Member\nfrom ..api.models.message import Message\nfrom ..api.models.misc import Snowflake\nfrom ..api.models.role import Role\n\nlog = getLogger(\"get\")\n\n_T = TypeVar(\"_T\")\n\nif TYPE_CHECKING:\n    from ..api.http.client import HTTPClient\n    from ..client.bot import Client\n\n__all__ = (\n    \"get\",\n    \"Force\",\n)\n\n\nclass Force(str, Enum):\n    \"\"\"\n    An enumerable object representing the force types for the get method.\n\n    :ivar str CACHE: Enforce the usage of cache and block the usage of http\n    :ivar str HTTP: Enforce the usage of http and block the usage of cache\n    \"\"\"\n\n    CACHE = \"cache\"\n    HTTP = \"http\"\n\n\ndef get(client: \"Client\", obj: Type[_T], **kwargs) -> Optional[_T]:\n    \"\"\"\n    Helper method to get an object.\n\n    This method can do the following:\n        * Get a list of specific objects\n            * purely from cache\n            * purely from HTTP\n            * from cache and additionally from HTTP for every ID that was not found in cache\n        * Get a single specific object\n            * purely from cache\n            * purely from HTTP\n            * from HTTP if not found in cache else from cache\n\n    The method has to be awaited when:\n        * You don't force anything\n        * You force HTTP\n    The method doesn't have to be awaited when:\n        * You force cache\n\n    .. note ::\n        Technically, there is no need for an ``await`` if there is an object found in the cache. Because of the fact,\n        that, as long as you don't enforce the cache, the function will get the object from HTTP, if it is not in the\n        cache, you still have to await it. This has been done to reduce confusion on whether the object origins from\n        an HTTP call or a cache result and to remove the extra step for you to check if the returned object is an\n        awaitable or not.\n\n\n    Forcing:\n        Forcing can be done via the ``force`` keyword argument.\n            * ``force=\"cache\"`` or ``force=interactions.Force.CACHE``:\n                This forces the method to only return from cache (if the object is not found it will return ``None``). If\n                you use this, you don't need to await the method.\n\n            * ``force=\"http\"`` or ``force=interactions.Force.HTTP``:\n                This forces the method to make an HTTP request to the discord API and return the result of it. If you\n                use this, you have to await the method.\n\n                .. attention ::\n                    If you are a PyCharm user, please be aware of a bug that causes incorrect suggestions to appear if\n                    using an enum. Even if PyCharm shows a normal object as result, you have to await the method if you\n                    enforce HTTP. To prevent this bug from happening it is suggested using ``force=\"http\"`` instead of\n                    the enum.\n\n    Getting an object:\n\n        Here you will see two examples on how to get a single objects and the variations of how the object can be\n        gotten.\n\n        * Example 1/2: Getting a Channel:\n\n            .. code-block:: python\n\n                # normally\n                channel = await get(client, interactions.Channel, object_id=your_channel_id)\n                # always has a value\n\n                # with http force\n                channel = await get(client, interactions.Channel, object_id=your_channel_id, force=\"http\")\n                # always has a value\n\n                # with cache force\n                channel = get(client, interactions.Channel, object_id=your_channel_id, force=\"cache\")\n                # because of cache only, this can be None\n\n\n        * Example 2/2: Getting a Member:\n\n            .. code-block:: python\n\n                # normally\n                member = await get(\n                    client, interactions.Member, parent_id=your_guild_id, object_id=your_member_id\n                )\n                # always has a value\n\n                # with http force\n                member = await get(\n                    client, interactions.Member, parent_id=your_guild_id, object_id=your_member_id\n                )\n                # always has a value\n\n                # with cache force\n                member = await get(\n                    client, interactions.Member, parent_id=your_guild_id, object_id=your_member_id\n                )\n                # because of cache only, this can be None\n\n\n        Both examples should have given you a basic overview on how to get a single object. Now we will move on with\n        lists of objects.\n\n        .. important::\n            The ``parent_id`` represents the channel or guild id that belongs to the objects you want to get. It is\n            called ``parent_id`` because ``guild_or_channel_id`` would be horrible to type out every time.\n\n    Getting a list of an object:\n        Here you will see 1 example of how to get a list of objects. The possibilities on how to force (and their\n        results) are the same as in the examples above.\n\n        * Example 1/1: Getting a list of members:\n\n            .. code-block:: python\n\n                from typing import List\n\n                # you can also use `list[interactions.Member]` if you have python >= 3.9\n\n                members = await get(\n                    client,\n                    List[interactions.Member],\n                    parent_id=your_guild_id,\n                    object_ids=[your_member_id1, your_member_id2, ...],\n                )\n\n\n        If you enforce cache when getting a list of objects, found objets will be placed into the list and not found\n        objects will be placed as ``None`` into the list.\n\n    \"\"\"\n\n    if version_info >= (3, 9):\n\n        def _check():\n            return (\n                obj == list[get_args(obj)[0]]\n                if isinstance(get_args(obj), tuple) and get_args(obj)\n                else False\n            )\n\n    else:\n\n        def _check():\n            return False\n\n    if not isinstance(obj, type) and not isinstance(obj, _GenericAlias):\n        raise LibraryException(message=\"The object must not be an instance of a class!\", code=12)\n\n    client: \"Client\"\n    obj: Union[Type[_T], Type[List[_T]]]\n    kwargs = _resolve_kwargs(obj, **kwargs)\n    http_name = f\"get_{obj.__name__.lower()}\"\n    kwarg_name = f\"{obj.__name__.lower()}_id\"\n\n    if isinstance(obj, _GenericAlias) or _check():\n        _obj: Type[_T] = get_args(obj)[0]\n        _objects: List[Union[_obj, Coroutine]] = []\n        kwarg_name += \"s\"\n\n        force_cache = kwargs.pop(\"force\", None) == \"cache\"\n        force_http = kwargs.pop(\"force\", None) == \"http\"\n\n        if not force_http:\n            _objects = _get_cache(_obj, client, kwarg_name, _list=True, **kwargs)\n\n        if force_cache:\n            return _objects\n\n        elif not force_http and None not in _objects:\n            return _return_cache(_objects)\n\n        elif force_http:\n            _objects.clear()\n            _func = getattr(client._http, http_name)\n            for _id in kwargs.get(kwarg_name):\n                _kwargs = kwargs\n                _kwargs.pop(kwarg_name)\n                _kwargs[kwarg_name[:-1]] = _id\n                _objects.append(_func(**_kwargs))\n            return _http_request(_obj, http=client._http, request=_objects)\n\n        else:\n            _func = getattr(client._http, http_name)\n            for _index, __obj in enumerate(_objects):\n                if __obj is None:\n                    _id = kwargs.get(kwarg_name)[_index]\n                    _kwargs = kwargs\n                    _kwargs.pop(kwarg_name)\n                    _kwargs[kwarg_name[:-1]] = _id\n                    _request = _func(**_kwargs)\n                    _objects[_index] = _request\n            return _http_request(_obj, http=client._http, request=_objects)\n\n    _obj: Optional[_T] = None\n\n    force_cache = kwargs.pop(\"force\", None) == \"cache\"\n    force_http = kwargs.pop(\"force\", None) == \"http\"\n    if not force_http:\n        _obj = _get_cache(obj, client, kwarg_name, **kwargs)\n\n    if force_cache:\n        return _obj\n\n    elif not force_http and _obj:\n        return _return_cache(_obj)\n\n    else:\n        return _http_request(obj=obj, http=client._http, _name=http_name, **kwargs)\n\n\nasync def _http_request(\n    obj: Type[_T],\n    http: \"HTTPClient\",\n    request: Union[Coroutine, List[Union[_T, Coroutine]], List[Coroutine]] = None,\n    _name: str = None,\n    **kwargs,\n) -> Union[_T, List[_T]]:\n    if not request:\n        if obj in (Role, Emoji):\n            from ..api.models.guild import Guild\n\n            _guild = Guild(**await http.get_guild(kwargs.pop(\"guild_id\")), _client=http)\n            _func = getattr(_guild, _name)\n            return await _func(**kwargs)\n\n        _func = getattr(http, _name)\n        _obj = await _func(**kwargs)\n        return obj(**_obj, _client=http)\n\n    if not isinstance(request, list):\n        return obj(**await request, _client=http)\n\n    return [obj(**await req, _client=http) if isawaitable(req) else req for req in request]\n\n\nasync def _return_cache(\n    obj: Union[Optional[_T], List[Optional[_T]]]\n) -> Union[Optional[_T], List[Optional[_T]]]:\n    await sleep(0)  # iirc Bluenix meant that any coroutine should await at least once\n    return obj\n\n\ndef _get_cache(\n    _object: Type[_T], client: \"Client\", kwarg_name: str, _list: bool = False, **kwargs\n) -> Union[Optional[_T], List[Optional[_T]]]:\n    if _list:\n        _obj = []\n        if _object == Member:  # Can't be more dynamic on this\n            _guild_id = Snowflake(kwargs.get(\"guild_id\"))\n            _values = [\n                (\n                    _guild_id,\n                    Snowflake(_id),\n                )\n                for _id in kwargs.get(\"member_ids\")\n            ]\n            _obj.extend(client._http.cache[_object].get(item, None) for item in _values)\n\n        else:\n            _obj.extend(\n                client._http.cache[_object].get(Snowflake(_id), None)\n                for _id in kwargs.get(kwarg_name)\n            )\n    else:\n        if _object == Member:\n            _values = (\n                Snowflake(kwargs.get(\"guild_id\")),\n                Snowflake(kwargs.get(\"member_id\")),\n            )  # Fuck it, I can't be dynamic on this\n        else:\n            _values = Snowflake(kwargs.get(kwarg_name))\n\n        _obj = client._http.cache[_object].get(_values)\n    return _obj\n\n\ndef _resolve_kwargs(obj, **kwargs):\n    # This function is needed to get correct kwarg names\n    if __id := kwargs.pop(\"parent_id\", None):\n\n        if version_info >= (3, 9):\n            _list = [Message, List[Message], list[Message]]\n        else:\n            _list = [Message, List[Message]]\n\n        kwargs[f\"{'channel_id' if obj in _list else 'guild_id'}\"] = __id\n\n    if __id := kwargs.pop(\"object_id\", None):\n        _kwarg_name = f\"{obj.__name__.lower()}_id\"\n        kwargs[_kwarg_name] = __id\n\n    elif __id := kwargs.pop(\"object_ids\", None):\n        _kwarg_name = f\"{get_args(obj)[0].__name__.lower()}_ids\"\n        kwargs[_kwarg_name] = __id\n\n    else:\n        raise LibraryException(code=12, message=\"The specified kwargs are invalid!\")\n\n    return kwargs\n", "path": "interactions/utils/get.py"}], "after_files": [{"content": "from asyncio import sleep\nfrom enum import Enum\nfrom inspect import isawaitable\nfrom logging import getLogger\nfrom typing import TYPE_CHECKING, Coroutine, List, Optional, Type, TypeVar, Union, get_args\n\ntry:\n    from typing import _GenericAlias\n\nexcept ImportError:\n    from typing import _BaseGenericAlias as _GenericAlias\n\nfrom sys import version_info\n\nfrom ..api.error import LibraryException\nfrom ..api.models.emoji import Emoji\nfrom ..api.models.member import Member\nfrom ..api.models.message import Message\nfrom ..api.models.misc import Snowflake\nfrom ..api.models.role import Role\n\nlog = getLogger(\"get\")\n\n_T = TypeVar(\"_T\")\n\nif TYPE_CHECKING:\n    from ..api.http.client import HTTPClient\n    from ..client.bot import Client\n\n__all__ = (\n    \"get\",\n    \"Force\",\n)\n\n\nclass Force(str, Enum):\n    \"\"\"\n    An enumerable object representing the force types for the get method.\n\n    :ivar str CACHE: Enforce the usage of cache and block the usage of http\n    :ivar str HTTP: Enforce the usage of http and block the usage of cache\n    \"\"\"\n\n    CACHE = \"cache\"\n    HTTP = \"http\"\n\n\ndef get(client: \"Client\", obj: Type[_T], **kwargs) -> Optional[_T]:\n    \"\"\"\n    Helper method to get an object.\n\n    This method can do the following:\n        * Get a list of specific objects\n            * purely from cache\n            * purely from HTTP\n            * from cache and additionally from HTTP for every ID that was not found in cache\n        * Get a single specific object\n            * purely from cache\n            * purely from HTTP\n            * from HTTP if not found in cache else from cache\n\n    The method has to be awaited when:\n        * You don't force anything\n        * You force HTTP\n    The method doesn't have to be awaited when:\n        * You force cache\n\n    .. note ::\n        Technically, there is no need for an ``await`` if there is an object found in the cache. Because of the fact,\n        that, as long as you don't enforce the cache, the function will get the object from HTTP, if it is not in the\n        cache, you still have to await it. This has been done to reduce confusion on whether the object origins from\n        an HTTP call or a cache result and to remove the extra step for you to check if the returned object is an\n        awaitable or not.\n\n\n    Forcing:\n        Forcing can be done via the ``force`` keyword argument.\n            * ``force=\"cache\"`` or ``force=interactions.Force.CACHE``:\n                This forces the method to only return from cache (if the object is not found it will return ``None``). If\n                you use this, you don't need to await the method.\n\n            * ``force=\"http\"`` or ``force=interactions.Force.HTTP``:\n                This forces the method to make an HTTP request to the discord API and return the result of it. If you\n                use this, you have to await the method.\n\n                .. attention ::\n                    If you are a PyCharm user, please be aware of a bug that causes incorrect suggestions to appear if\n                    using an enum. Even if PyCharm shows a normal object as result, you have to await the method if you\n                    enforce HTTP. To prevent this bug from happening it is suggested using ``force=\"http\"`` instead of\n                    the enum.\n\n    Getting an object:\n\n        Here you will see two examples on how to get a single objects and the variations of how the object can be\n        gotten.\n\n        * Example 1/2: Getting a Channel:\n\n            .. code-block:: python\n\n                # normally\n                channel = await get(client, interactions.Channel, object_id=your_channel_id)\n                # always has a value\n\n                # with http force\n                channel = await get(client, interactions.Channel, object_id=your_channel_id, force=\"http\")\n                # always has a value\n\n                # with cache force\n                channel = get(client, interactions.Channel, object_id=your_channel_id, force=\"cache\")\n                # because of cache only, this can be None\n\n\n        * Example 2/2: Getting a Member:\n\n            .. code-block:: python\n\n                # normally\n                member = await get(\n                    client, interactions.Member, parent_id=your_guild_id, object_id=your_member_id\n                )\n                # always has a value\n\n                # with http force\n                member = await get(\n                    client, interactions.Member, parent_id=your_guild_id, object_id=your_member_id\n                )\n                # always has a value\n\n                # with cache force\n                member = await get(\n                    client, interactions.Member, parent_id=your_guild_id, object_id=your_member_id\n                )\n                # because of cache only, this can be None\n\n\n        Both examples should have given you a basic overview on how to get a single object. Now we will move on with\n        lists of objects.\n\n        .. important::\n            The ``parent_id`` represents the channel or guild id that belongs to the objects you want to get. It is\n            called ``parent_id`` because ``guild_or_channel_id`` would be horrible to type out every time.\n\n    Getting a list of an object:\n        Here you will see 1 example of how to get a list of objects. The possibilities on how to force (and their\n        results) are the same as in the examples above.\n\n        * Example 1/1: Getting a list of members:\n\n            .. code-block:: python\n\n                from typing import List\n\n                # you can also use `list[interactions.Member]` if you have python >= 3.9\n\n                members = await get(\n                    client,\n                    List[interactions.Member],\n                    parent_id=your_guild_id,\n                    object_ids=[your_member_id1, your_member_id2, ...],\n                )\n\n\n        If you enforce cache when getting a list of objects, found objets will be placed into the list and not found\n        objects will be placed as ``None`` into the list.\n\n    \"\"\"\n\n    if version_info >= (3, 9):\n\n        def _check():\n            return (\n                obj == list[get_args(obj)[0]]\n                if isinstance(get_args(obj), tuple) and get_args(obj)\n                else False\n            )\n\n    else:\n\n        def _check():\n            return False\n\n    if not isinstance(obj, type) and not isinstance(obj, _GenericAlias):\n        raise LibraryException(message=\"The object must not be an instance of a class!\", code=12)\n\n    client: \"Client\"\n    obj: Union[Type[_T], Type[List[_T]]]\n    kwargs = _resolve_kwargs(obj, **kwargs)\n    http_name = f\"get_{obj.__name__.lower()}\"\n    kwarg_name = f\"{obj.__name__.lower()}_id\"\n\n    if isinstance(obj, _GenericAlias) or _check():\n        _obj: Type[_T] = get_args(obj)[0]\n        _objects: List[Union[_obj, Coroutine]] = []\n        kwarg_name += \"s\"\n\n        force_arg = kwargs.pop(\"force\", None)\n        force_cache = force_arg == \"cache\"\n        force_http = force_arg == \"http\"\n\n        if not force_http:\n            _objects = _get_cache(_obj, client, kwarg_name, _list=True, **kwargs)\n\n        if force_cache:\n            return _objects\n\n        elif not force_http and None not in _objects:\n            return _return_cache(_objects)\n\n        elif force_http:\n            _objects.clear()\n            _func = getattr(client._http, http_name)\n            for _id in kwargs.get(kwarg_name):\n                _kwargs = kwargs\n                _kwargs.pop(kwarg_name)\n                _kwargs[kwarg_name[:-1]] = _id\n                _objects.append(_func(**_kwargs))\n            return _http_request(_obj, http=client._http, request=_objects)\n\n        else:\n            _func = getattr(client._http, http_name)\n            for _index, __obj in enumerate(_objects):\n                if __obj is None:\n                    _id = kwargs.get(kwarg_name)[_index]\n                    _kwargs = kwargs\n                    _kwargs.pop(kwarg_name)\n                    _kwargs[kwarg_name[:-1]] = _id\n                    _request = _func(**_kwargs)\n                    _objects[_index] = _request\n            return _http_request(_obj, http=client._http, request=_objects)\n\n    _obj: Optional[_T] = None\n\n    force_arg = kwargs.pop(\"force\", None)\n    force_cache = force_arg == \"cache\"\n    force_http = force_arg == \"http\"\n\n    if not force_http:\n        _obj = _get_cache(obj, client, kwarg_name, **kwargs)\n\n    if force_cache:\n        return _obj\n\n    elif not force_http and _obj:\n        return _return_cache(_obj)\n\n    else:\n        return _http_request(obj=obj, http=client._http, _name=http_name, **kwargs)\n\n\nasync def _http_request(\n    obj: Type[_T],\n    http: \"HTTPClient\",\n    request: Union[Coroutine, List[Union[_T, Coroutine]], List[Coroutine]] = None,\n    _name: str = None,\n    **kwargs,\n) -> Union[_T, List[_T]]:\n    if not request:\n        if obj in (Role, Emoji):\n            from ..api.models.guild import Guild\n\n            _guild = Guild(**await http.get_guild(kwargs.pop(\"guild_id\")), _client=http)\n            _func = getattr(_guild, _name)\n            return await _func(**kwargs)\n\n        _func = getattr(http, _name)\n        _obj = await _func(**kwargs)\n        return obj(**_obj, _client=http)\n\n    if not isinstance(request, list):\n        return obj(**await request, _client=http)\n\n    return [obj(**await req, _client=http) if isawaitable(req) else req for req in request]\n\n\nasync def _return_cache(\n    obj: Union[Optional[_T], List[Optional[_T]]]\n) -> Union[Optional[_T], List[Optional[_T]]]:\n    await sleep(0)  # iirc Bluenix meant that any coroutine should await at least once\n    return obj\n\n\ndef _get_cache(\n    _object: Type[_T], client: \"Client\", kwarg_name: str, _list: bool = False, **kwargs\n) -> Union[Optional[_T], List[Optional[_T]]]:\n    if _list:\n        _obj = []\n        if _object == Member:  # Can't be more dynamic on this\n            _guild_id = Snowflake(kwargs.get(\"guild_id\"))\n            _values = [\n                (\n                    _guild_id,\n                    Snowflake(_id),\n                )\n                for _id in kwargs.get(\"member_ids\")\n            ]\n            _obj.extend(client._http.cache[_object].get(item, None) for item in _values)\n\n        else:\n            _obj.extend(\n                client._http.cache[_object].get(Snowflake(_id), None)\n                for _id in kwargs.get(kwarg_name)\n            )\n    else:\n        if _object == Member:\n            _values = (\n                Snowflake(kwargs.get(\"guild_id\")),\n                Snowflake(kwargs.get(\"member_id\")),\n            )  # Fuck it, I can't be dynamic on this\n        else:\n            _values = Snowflake(kwargs.get(kwarg_name))\n\n        _obj = client._http.cache[_object].get(_values)\n    return _obj\n\n\ndef _resolve_kwargs(obj, **kwargs):\n    # This function is needed to get correct kwarg names\n    if __id := kwargs.pop(\"parent_id\", None):\n\n        if version_info >= (3, 9):\n            _list = [Message, List[Message], list[Message]]\n        else:\n            _list = [Message, List[Message]]\n\n        kwargs[f\"{'channel_id' if obj in _list else 'guild_id'}\"] = __id\n\n    if __id := kwargs.pop(\"object_id\", None):\n        _kwarg_name = f\"{obj.__name__.lower()}_id\"\n        kwargs[_kwarg_name] = __id\n\n    elif __id := kwargs.pop(\"object_ids\", None):\n        _kwarg_name = f\"{get_args(obj)[0].__name__.lower()}_ids\"\n        kwargs[_kwarg_name] = __id\n\n    else:\n        raise LibraryException(code=12, message=\"The specified kwargs are invalid!\")\n\n    return kwargs\n", "path": "interactions/utils/get.py"}]}