File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 57
57
from .guild import Guild
58
58
from .state import ConnectionState
59
59
from .ext .commands import Cog , Greedy , Converter
60
- from .interactions import ApplicationCommandInteraction
60
+ from .interactions import ApplicationCommandInteraction , BaseInteraction
61
61
62
62
__all__ = (
63
63
'Localizations' ,
@@ -111,6 +111,21 @@ class Localizations:
111
111
ukrainian='Привіт світ!'
112
112
)
113
113
114
+ You can also use this to build localized responses.
115
+
116
+ .. code-block:: python3
117
+
118
+ @slash_command(name='hello', description='Says hello to you.')
119
+ async def hello_command(interaction: ApplicationCommandInteraction):
120
+ response = Localizations(
121
+ en_US='Hello World!',
122
+ de='Hallo Welt!',
123
+ fr='Bonjour le monde!'
124
+ uk='Привіт світ!',
125
+ ...
126
+ ).from_target(interaction) # of curse you can store the localizations somewhere else and import/load them.
127
+ await interaction.respond(response)
128
+
114
129
Parameters
115
130
----------
116
131
kwargs: Any
You can’t perform that action at this time.
0 commit comments