From 7c8503fefbf5d75734e528b5525c647df6302b8e Mon Sep 17 00:00:00 2001
From: DA344 <108473820+DA-344@users.noreply.github.com>
Date: Thu, 16 Jan 2025 00:27:03 +0100
Subject: [PATCH] Fix callable FlagConverter defaults on hybrid commands

fix: Callable FlagConverter defaults being returned as-is on interaction based calls.
---
 discord/ext/commands/hybrid.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/discord/ext/commands/hybrid.py b/discord/ext/commands/hybrid.py
index e84e7e03e..af9e63a7b 100644
--- a/discord/ext/commands/hybrid.py
+++ b/discord/ext/commands/hybrid.py
@@ -234,6 +234,12 @@ def replace_parameter(
                     descriptions[name] = flag.description
                 if flag.name != flag.attribute:
                     renames[name] = flag.name
+                if pseudo.default is not pseudo.empty:
+                    # This ensures the default is wrapped around _CallableDefault if callable
+                    # else leaves it as-is.
+                    pseudo = pseudo.replace(
+                        default=_CallableDefault(flag.default) if callable(flag.default) else flag.default
+                    )
 
                 mapping[name] = pseudo
 
@@ -283,7 +289,7 @@ def replace_parameters(
             param = param.replace(default=default)
 
         if isinstance(param.default, Parameter):
-            # If we're here, then then it hasn't been handled yet so it should be removed completely
+            # If we're here, then it hasn't been handled yet so it should be removed completely
             param = param.replace(default=parameter.empty)
 
         # Flags are flattened out and thus don't get their parameter in the actual mapping