Allow for floats in timespan pattern matching
This commit is contained in:
parent
f0b66f6415
commit
b4d795f843
|
@ -49,7 +49,7 @@ namespace DeukBot4.MessageHandlers.CommandHandler.RequestStructure
|
||||||
case ParameterType.User:
|
case ParameterType.User:
|
||||||
return $" *(?:<@(?<{index}>\\d+)>|(?<{index}>\\d+)(?:$| |\n))";
|
return $" *(?:<@(?<{index}>\\d+)>|(?<{index}>\\d+)(?:$| |\n))";
|
||||||
case ParameterType.Timespan:
|
case ParameterType.Timespan:
|
||||||
return $" *(?<{index}>\\d+[smhd])";
|
return $" *(?<{index}>\\d+.*d*[smhd])";
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException(nameof(type), type, null);
|
throw new ArgumentOutOfRangeException(nameof(type), type, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace DeukBot4.Utilities
|
||||||
{
|
{
|
||||||
var timeIndicator = s.Last();
|
var timeIndicator = s.Last();
|
||||||
var numberStr = s.Remove(s.Length - 1, 1);
|
var numberStr = s.Remove(s.Length - 1, 1);
|
||||||
if (!int.TryParse(numberStr, out var number))
|
if (!float.TryParse(numberStr, out var number))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue