mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
use correct name for resolving flags and params in codegen
This commit is contained in:
parent
42c9429953
commit
ca9f25ff64
2 changed files with 11 additions and 8 deletions
|
|
@ -8,7 +8,7 @@ public partial class CommandTree
|
|||
{
|
||||
if (commands.Length == 0)
|
||||
{
|
||||
await ctx.Reply($"No commands related to {subject} was found. For the full list of commands, see the website: <https://pluralkit.me/commands>");
|
||||
await ctx.Reply($"No commands related to `{subject}` was found. For the full list of commands, see the website: <https://pluralkit.me/commands>");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ public partial class CommandTree
|
|||
new MessageComponent()
|
||||
{
|
||||
Type = ComponentType.Text,
|
||||
Content = $"Here is a list of commands related to {subject}:\n{commands}\nFor a full list of possible commands, see <https://pluralkit.me/commands>.",
|
||||
Content = $"Here is a list of commands related to `{subject}`:\n{commands}\nFor a full list of possible commands, see <https://pluralkit.me/commands>.",
|
||||
}
|
||||
]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -45,8 +45,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
for param in &command_params {
|
||||
writeln!(
|
||||
&mut command_params_init,
|
||||
r#"@{name} = await ctx.ParamResolve{extract_fn_name}("{name}"){throw_null},"#,
|
||||
name = param.name().replace("-", "_"),
|
||||
r#"@{fieldName} = await ctx.ParamResolve{extract_fn_name}("{name}"){throw_null},"#,
|
||||
fieldName = param.name().replace("-", "_"),
|
||||
name = param.name(),
|
||||
extract_fn_name = get_param_param_ty(param.kind()),
|
||||
throw_null = param
|
||||
.is_optional()
|
||||
|
|
@ -59,15 +60,17 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
if let Some(param) = flag.get_value() {
|
||||
writeln!(
|
||||
&mut command_flags_init,
|
||||
r#"@{name} = await ctx.FlagResolve{extract_fn_name}("{name}"),"#,
|
||||
name = flag.get_name().replace("-", "_"),
|
||||
r#"@{fieldName} = await ctx.FlagResolve{extract_fn_name}("{name}"),"#,
|
||||
fieldName = flag.get_name().replace("-", "_"),
|
||||
name = flag.get_name(),
|
||||
extract_fn_name = get_param_param_ty(param.kind()),
|
||||
)?;
|
||||
} else {
|
||||
writeln!(
|
||||
&mut command_flags_init,
|
||||
r#"@{name} = ctx.Parameters.HasFlag("{name}"),"#,
|
||||
name = flag.get_name().replace("-", "_"),
|
||||
r#"@{fieldName} = ctx.Parameters.HasFlag("{name}"),"#,
|
||||
fieldName = flag.get_name().replace("-", "_"),
|
||||
name = flag.get_name(),
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue