From 8c3cdf20a6e24bcadb3fce75c67f4e136d506058 Mon Sep 17 00:00:00 2001 From: Michael Oliveira <34169552+Flame442@users.noreply.github.com> Date: Mon, 25 Aug 2025 16:52:06 -0400 Subject: [PATCH] Inject guild locale information in app commands (#6579) --- redbot/core/tree.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/redbot/core/tree.py b/redbot/core/tree.py index 4b32dcf8f..d86782415 100644 --- a/redbot/core/tree.py +++ b/redbot/core/tree.py @@ -19,7 +19,10 @@ from .app_commands import ( TransformerError, UserFeedbackCheckFailure, ) -from .i18n import Translator +from redbot.core.i18n import ( + Translator, + set_contextual_locales_from_guild, +) from .utils.chat_formatting import humanize_list, inline import logging @@ -395,3 +398,9 @@ class RedTree(CommandTree): for key in remove: del self._disabled_global_commands[key] + + # DEP-WARN + async def _call(self, interaction: discord.Interaction, *args, **kwargs) -> None: + """Configure the contextual locale based on the interaction guild prior to invoking.""" + await set_contextual_locales_from_guild(interaction.client, interaction.guild) + await super()._call(interaction, *args, **kwargs)