|
12 | 12 | from ..base import get_logger |
13 | 13 | from ..utils.attrs_utils import ClientSerializerMixin, convert_int, define, field |
14 | 14 | from ..utils.missing import MISSING |
15 | | -from .enums import ComponentType, InteractionCallbackType, InteractionType |
| 15 | +from .enums import ComponentType, InteractionCallbackType, InteractionType, Locale |
16 | 16 | from .models.command import Choice |
17 | 17 | from .models.component import ActionRow, Button, Modal, SelectMenu, _build_components |
18 | 18 | from .models.misc import InteractionData |
@@ -66,6 +66,8 @@ class _Context(ClientSerializerMixin): |
66 | 66 | responded: bool = field(default=False) |
67 | 67 | deferred: bool = field(default=False) |
68 | 68 | app_permissions: Permissions = field(converter=convert_int(Permissions), default=None) |
| 69 | + locale: Optional[Locale] = field(converter=Locale, default=None) |
| 70 | + guild_locale: Optional[Locale] = field(converter=Locale, default=None) |
69 | 71 |
|
70 | 72 | def __attrs_post_init__(self) -> None: |
71 | 73 | if self.member and self.guild_id: |
@@ -364,8 +366,8 @@ class CommandContext(_Context): |
364 | 366 | :ivar Snowflake channel_id: The ID of the current channel. |
365 | 367 | :ivar bool responded: Whether an original response was made or not. |
366 | 368 | :ivar bool deferred: Whether the response was deferred or not. |
367 | | - :ivar str locale: The selected language of the user invoking the interaction. |
368 | | - :ivar str guild_locale: The guild's preferred language, if invoked in a guild. |
| 369 | + :ivar Optional[Locale] locale: The selected language of the user invoking the interaction. |
| 370 | + :ivar Optional[Locale] guild_locale: The guild's preferred language, if invoked in a guild. |
369 | 371 | :ivar str app_permissions: Bitwise set of permissions the bot has within the channel the interaction was sent from. |
370 | 372 | :ivar Client client: The client instance that the command belongs to. |
371 | 373 | :ivar Command command: The command object that is being invoked. |
|
0 commit comments