diff --git a/src/Commands/RemindCommandGroup.cs b/src/Commands/RemindCommandGroup.cs index 77f2429..5e8c9c5 100644 --- a/src/Commands/RemindCommandGroup.cs +++ b/src/Commands/RemindCommandGroup.cs @@ -111,7 +111,7 @@ public class RemindCommandGroup : CommandGroup /// /// A slash command that schedules a reminder with the specified text. /// - /// The period of time which must pass before the reminder will be sent. + /// The period of time which must pass before the reminder will be sent. /// The text of the reminder. /// A feedback sending result which may or may not have succeeded. [Command("remind")] @@ -122,7 +122,7 @@ public class RemindCommandGroup : CommandGroup public async Task ExecuteReminderAsync( [Description("After what period of time mention the reminder")] [Option("in")] - string stringTimeSpan, + string timeSpanString, [Description("Reminder text")] [MaxLength(512)] string text) { @@ -146,7 +146,7 @@ public class RemindCommandGroup : CommandGroup var data = await _guildData.GetData(guildId, CancellationToken); Messages.Culture = GuildSettings.Language.Get(data.Settings); - var parseResult = TimeSpanParser.TryParse(stringTimeSpan); + var parseResult = TimeSpanParser.TryParse(timeSpanString); if (!parseResult.IsDefined(out var timeSpan)) { var failedEmbed = new EmbedBuilder() diff --git a/src/Parsers/TimeSpanParser.cs b/src/Parsers/TimeSpanParser.cs index e00c09e..4ef8bf2 100644 --- a/src/Parsers/TimeSpanParser.cs +++ b/src/Parsers/TimeSpanParser.cs @@ -15,14 +15,11 @@ public partial class TimeSpanParser : AbstractTypeParser private static readonly Regex Pattern = ParseRegex(); /// - /// Parses from . + /// Parses a from the . /// /// - /// Parsed . + /// The parsed , or if parsing failed. /// - /// - /// If parse wasn't successful, will return . - /// public static Result TryParse(string timeSpanString) { if (timeSpanString.StartsWith('-')) @@ -44,7 +41,7 @@ public partial class TimeSpanParser : AbstractTypeParser return ParseFromRegex(matches); } - private static TimeSpan ParseFromRegex(MatchCollection matches) + private static Result ParseFromRegex(MatchCollection matches) { var timeSpan = TimeSpan.Zero; @@ -59,7 +56,7 @@ public partial class TimeSpanParser : AbstractTypeParser if (!double.TryParse(groupValue, out var parsedGroupValue) || !int.TryParse(groupValue, out var parsedIntegerValue)) { - return TimeSpan.Zero; + return new ArgumentInvalidError(nameof(groupValue), "The input value encountered a parsing error."); } var now = DateTimeOffset.UtcNow;