mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-18 15:06:07 +00:00
Fix callable FlagConverter defaults on hybrid commands
fix: Callable FlagConverter defaults being returned as-is on interaction based calls.
This commit is contained in:
parent
ed95f2f106
commit
7c8503fefb
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user