Allow for floats in timespan pattern matching

This commit is contained in:
Deukhoofd 2018-05-06 18:54:06 +02:00
parent f0b66f6415
commit b4d795f843
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
2 changed files with 2 additions and 2 deletions

View File

@ -49,7 +49,7 @@ namespace DeukBot4.MessageHandlers.CommandHandler.RequestStructure
case ParameterType.User:
return $" *(?:<@(?<{index}>\\d+)>|(?<{index}>\\d+)(?:$| |\n))";
case ParameterType.Timespan:
return $" *(?<{index}>\\d+[smhd])";
return $" *(?<{index}>\\d+.*d*[smhd])";
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}

View File

@ -9,7 +9,7 @@ namespace DeukBot4.Utilities
{
var timeIndicator = s.Last();
var numberStr = s.Remove(s.Length - 1, 1);
if (!int.TryParse(numberStr, out var number))
if (!float.TryParse(numberStr, out var number))
{
return null;
}