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
:param description_localizations?: The dictionary of localization for the ``description`` field. This enforces the same restrictions as the ``description`` field.
Copy file name to clipboardExpand all lines: interactions/models/command.py
+76-9Lines changed: 76 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
from ..api.models.channelimportChannelType
4
4
from ..api.models.miscimportDictSerializerMixin, Snowflake
5
-
from ..enumsimportApplicationCommandType, OptionType, PermissionType
5
+
from ..enumsimportApplicationCommandType, Locale, OptionType, PermissionType
6
6
7
7
8
8
classChoice(DictSerializerMixin):
@@ -21,15 +21,29 @@ class Choice(DictSerializerMixin):
21
21
22
22
:ivar str name: The name of the choice.
23
23
:ivar Union[str, int, float] value: The returned value of the choice.
24
+
:ivar Optional[Dict[Union[str, Locale], str]] name_localizations?: The dictionary of localization for the ``name`` field. This enforces the same restrictions as the ``name`` field.
): # check if Locale object is used to create localisation at any certain point.
39
+
self._json["name_localizations"] = {
40
+
k.valueifisinstance(k, Locale) elsek: v
41
+
fork, vinself._json["name_localizations"].items()
42
+
}
43
+
self.name_localizations= {
44
+
kifisinstance(k, Locale) elseLocale(k): v
45
+
fork, vinself._json["name_localizations"].items()
46
+
}
33
47
34
48
35
49
classOption(DictSerializerMixin):
@@ -67,6 +81,8 @@ class Option(DictSerializerMixin):
67
81
:ivar Optional[int] min_value?: The minimum value supported by the option.
68
82
:ivar Optional[int] max_value?: The maximum value supported by the option.
69
83
:ivar Optional[bool] autocomplete?: A status denoting whether this option is an autocomplete option.
84
+
:ivar Optional[Dict[Union[str, Locale], str]] name_localizations?: The dictionary of localization for the ``name`` field. This enforces the same restrictions as the ``name`` field.
85
+
:ivar Optional[Dict[Union[str, Locale], str]] description_localizations?: The dictionary of localization for the ``description`` field. This enforces the same restrictions as the ``description`` field.
70
86
"""
71
87
72
88
__slots__= (
@@ -99,9 +115,8 @@ class Option(DictSerializerMixin):
99
115
min_value: Optional[int]
100
116
max_value: Optional[int]
101
117
autocomplete: Optional[bool]
102
-
103
-
name_localizations: Optional[Dict[str, str]] # TODO: post-v4: document these when Discord does.
0 commit comments