argument
Base classes for the types used within Helply.
Argument
dataclass
¶
Represents a SlashCommand argument.
Attributes:
-
name
(str
) –Argument's non-localized name
-
description
(str
) –Argument's non-localized description
-
required
(bool
) –Whether or not the argument is required.
-
name_localizations
(LocalizationValue
) –Contains localizations for the argument's name. (New in version 0.3.0)
-
description_localizations
(LocalizationValue
) –Contains localizations for the argument's description. (New in version 0.3.0)
Methods:
-
get_localized_name
–Return localized or non-localized name. (New in version 0.3.0)
-
get_localized_description
–Return localized or non-localized description. (New in version 0.3.0)
-
localize
–Return an Argument with localized attributes (New in version 0.3.0)
Source code in src\helply\types\argument.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
get_localized_description(locale)
¶
Return localized or non-localized description. specified by the provided locale.
If not available, return the non-localized description instead.
Parameters:
-
locale
(Locale
) –The interaction locale
Returns:
-
str
–The localized or non-localized description.
Source code in src\helply\types\argument.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
get_localized_name(locale)
¶
Return localized or non-localized name. specified by the provided locale.
If not available, return the non-localized name instead.
Parameters:
-
locale
(Locale
) –The interaction locale
Returns:
-
str
–The localized or non-localized name.
Source code in src\helply\types\argument.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
localize(locale)
¶
Return a Argument instance with localized name and description.
Parameters:
-
locale
(Locale
) –The locale that should be used to localize the argument.
Returns:
-
Argument
–This argument with localized name and description
Source code in src\helply\types\argument.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|