Help part 2
This commit is contained in:
@@ -26,7 +26,22 @@ namespace EventBot.Misc
|
||||
|
||||
public static string FormatCallHelpString(this CommandInfo command)
|
||||
{
|
||||
return $"{command.Aliases[0]} {string.Join(" ", command.Parameters.Select(p => p.IsOptional ? $"[{p.Name}]" : $"<{p.Name}>"))}";
|
||||
return $"{command.Aliases[0]} {string.Join(" ", command.Parameters.Select(p => p.FormatParameter()))}";
|
||||
}
|
||||
|
||||
public static string FormatParameter(this ParameterInfo p) => p.IsOptional ? $"[{p.Name}]" : $"<{p.Name}>";
|
||||
public static string FormatParameterType(this ParameterInfo p)
|
||||
{
|
||||
var @switch = new Dictionary<Type, Func<ParameterInfo, string>>()
|
||||
{
|
||||
{ typeof(int), (_) => "Number" },
|
||||
|
||||
};
|
||||
if (@switch.ContainsKey(p.Type))
|
||||
return @switch[p.Type](p);
|
||||
else
|
||||
return p.Type.Name;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user