Skip to content

Commit 99c7c4c

Browse files
authored
Auto inject locale information in app commands
1 parent 6603cd1 commit 99c7c4c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

redbot/core/tree.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
TransformerError,
2020
UserFeedbackCheckFailure,
2121
)
22-
from .i18n import Translator
22+
from redbot.core.i18n import (
23+
Translator,
24+
set_contextual_locales_from_guild,
25+
)
2326
from .utils.chat_formatting import humanize_list, inline
2427

2528
import logging
@@ -395,3 +398,9 @@ def _remove_with_module(self, name: str, *args, **kwargs) -> None:
395398

396399
for key in remove:
397400
del self._disabled_global_commands[key]
401+
402+
# DEP-WARN
403+
async def _call(self, interaction: discord.Interaction, *args, **kwargs) -> None:
404+
"""Configure the contextual locale based on the interaction guild prior to invoking."""
405+
await set_contextual_locales_from_guild(interaction.client, interaction.guild)
406+
await super()._call(interaction, *args, **kwargs)

0 commit comments

Comments
 (0)