mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[CustomCommands] Show parameter name correctly in help (#2102)
This commit is contained in:
parent
bce5dd26f3
commit
c1d8272b49
@ -412,13 +412,18 @@ class CustomCommands:
|
|||||||
index + low, fin[index].annotation.__name__, anno.__name__
|
index + low, fin[index].annotation.__name__, anno.__name__
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
name = "{}_{}".format(
|
if anno is not Parameter.empty:
|
||||||
"text" if anno is Parameter.empty else anno.__name__.lower(),
|
fin[index] = fin[index].replace(annotation=anno)
|
||||||
index if index < high else "final",
|
|
||||||
)
|
|
||||||
fin[index] = fin[index].replace(name=name, annotation=anno)
|
|
||||||
# consume rest
|
# consume rest
|
||||||
fin[-1] = fin[-1].replace(kind=Parameter.KEYWORD_ONLY)
|
fin[-1] = fin[-1].replace(kind=Parameter.KEYWORD_ONLY)
|
||||||
|
# name the parameters for the help text
|
||||||
|
for i, param in enumerate(fin):
|
||||||
|
anno = param.annotation
|
||||||
|
name = "{}_{}".format(
|
||||||
|
"text" if anno is Parameter.empty else anno.__name__.lower(),
|
||||||
|
i if i < high else "final",
|
||||||
|
)
|
||||||
|
fin[i] = fin[i].replace(name=name)
|
||||||
# insert ctx parameter for discord.py parsing
|
# insert ctx parameter for discord.py parsing
|
||||||
fin = default + [(p.name, p) for p in fin]
|
fin = default + [(p.name, p) for p in fin]
|
||||||
return OrderedDict(fin)
|
return OrderedDict(fin)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user