You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
msgspec version - 0.18.4
Sending StringSelectOption with emoji=CustomEmoji when msgspec is installed (used) results with TypeError: Object of type <class 'interactions.models.discord.snowflake.Snowflake'> is not JSON serializable
This bug occurs only with msgspec. Default json and orjson work without any problems.
Steps to Reproduce
Send message with StringSelectMenu, where StringSelectOption.emoji = CustomEmoji, when msgspec is installed (used)
Test command to reproduce (msgspec must be installed):
File "C:\fox\Lib\site-packages\interactions\client\client.py", line 1900, in __dispatch_interaction
response = await callback
^^^^^^^^^^^^^^
File "C:\fox\Lib\site-packages\interactions\client\client.py", line 1771, in _run_slash_command
return await command(ctx, **ctx.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\fox\Lib\site-packages\interactions\models\internal\command.py", line 132, in __call__
await self.call_callback(self.callback, context)
File "C:\fox\Lib\site-packages\interactions\models\internal\application_commands.py", line 802, in call_callback
return await self.call_with_binding(callback, ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\fox\Lib\site-packages\interactions\models\internal\callback.py", line 43, in call_with_binding
return await callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Lacosst0\PycharmProjects\mister_selectus\bot.py", line 47, in test
await ctx.respond(
File "C:\fox\Lib\site-packages\interactions\models\internal\context.py", line 531, in send
return await super().send(
^^^^^^^^^^^^^^^^^^^
File "C:\fox\Lib\site-packages\interactions\client\mixins\send.py", line 110, in send
message_data = await self._send_http_request(message_payload, files=files or file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\fox\Lib\site-packages\interactions\models\internal\context.py", line 453, in _send_http_request
message_data = await self.client.http.post_initial_response(payload, self.id, self.token, files=files)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\fox\Lib\site-packages\interactions\api\http\http_requests\interactions.py", line 149, in post_initial_response
return await self.request(
^^^^^^^^^^^^^^^^^^^
File "C:\fox\Lib\site-packages\interactions\api\http\http_client.py", line 397, in request
async with self.__session.request(route.method, route.url, **kwargs) as response:
File "C:\fox\Lib\site-packages\aiohttp\client.py", line 1186, in __aenter__
self._resp = await self._coro
^^^^^^^^^^^^^^^^
File "C:\fox\Lib\site-packages\aiohttp\client.py", line 429, in _request
data = payload.JsonPayload(json, dumps=self._json_serialize)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\fox\Lib\site-packages\aiohttp\payload.py", line 396, in __init__
dumps(value).encode(encoding),
^^^^^^^^^^^^
File "C:\fox\Lib\site-packages\interactions\client\utils\input_utils.py", line 76, in dumps
data = json.dumps(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\fox\Lib\site-packages\interactions\client\utils\input_utils.py", line 32, in enc_hook
raise TypeError(f"Object of type {type(obj)} is not JSON serializable")
TypeError: Object of type <class 'interactions.models.discord.snowflake.Snowflake'> is not JSON serializable
Checklist
I have searched the open issues for duplicates.
I have shown the entire traceback, if possible.
I have removed my token from display, if visible.
I have attempted to debug this myself, and I believe this issue is with the library
Library Version
5.10.0
Describe the Bug
msgspec version - 0.18.4
Sending
StringSelectOption
withemoji=CustomEmoji
whenmsgspec
is installed (used) results withTypeError: Object of type <class 'interactions.models.discord.snowflake.Snowflake'> is not JSON serializable
This bug occurs only with msgspec. Default json and orjson work without any problems.
Steps to Reproduce
StringSelectMenu
, whereStringSelectOption.emoji = CustomEmoji
, whenmsgspec
is installed (used)Test command to reproduce (
msgspec
must be installed):Expected Results
Bot sends Message with StringSelectMenu where StringSelectOption has custom emoji
Minimal Reproducible Code
Traceback
Checklist
Additional Information
You can find more information about that bug in official interactions.py discord server: https://discord.com/channels/789032594456576001/1163083993474941019
The text was updated successfully, but these errors were encountered: