Skip to content

Commit 0cea688

Browse files
authored
fix: Snowflake encoding issue when msgspec is used fix (#1562)
* fix: Snowflake encoding issue when msgspec is used Signed-off-by: Lacosst0 <68904262+Lacosst0@users.noreply.github.com> * Combine 2 isinstance into 1 Signed-off-by: Lacosst0 <68904262+Lacosst0@users.noreply.github.com> --------- Signed-off-by: Lacosst0 <68904262+Lacosst0@users.noreply.github.com>
1 parent e5ef5c1 commit 0cea688

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

interactions/client/utils/input_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import re
33
import typing
44
from enum import IntFlag
5+
from interactions.models.discord.snowflake import Snowflake
56
from typing import Any, Dict, Union, Optional
67

78
import aiohttp # type: ignore
@@ -25,8 +26,8 @@
2526
import msgspec.json as json
2627

2728
def enc_hook(obj: Any) -> int:
28-
# msgspec doesnt support IntFlags
29-
if isinstance(obj, IntFlag):
29+
# msgspec doesnt support IntFlags or interactions.Snowflakes
30+
if isinstance(obj, (IntFlag, Snowflake)):
3031
return int(obj)
3132
raise TypeError(f"Object of type {type(obj)} is not JSON serializable")
3233

0 commit comments

Comments
 (0)