mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-19 16:33:36 +03:00
stashed changes my beloved
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
parent
76e353ef66
commit
97d19973b5
2 changed files with 7 additions and 10 deletions
|
@ -111,7 +111,7 @@ public class RemindCommandGroup : CommandGroup
|
|||
/// <summary>
|
||||
/// A slash command that schedules a reminder with the specified text.
|
||||
/// </summary>
|
||||
/// <param name="stringTimeSpan">The period of time which must pass before the reminder will be sent.</param>
|
||||
/// <param name="timeSpanString">The period of time which must pass before the reminder will be sent.</param>
|
||||
/// <param name="text">The text of the reminder.</param>
|
||||
/// <returns>A feedback sending result which may or may not have succeeded.</returns>
|
||||
[Command("remind")]
|
||||
|
@ -122,7 +122,7 @@ public class RemindCommandGroup : CommandGroup
|
|||
public async Task<Result> 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()
|
||||
|
|
|
@ -15,14 +15,11 @@ public partial class TimeSpanParser : AbstractTypeParser<TimeSpan>
|
|||
private static readonly Regex Pattern = ParseRegex();
|
||||
|
||||
/// <summary>
|
||||
/// Parses <see cref="TimeSpan"/> from <see cref="string"/>.
|
||||
/// Parses a <see cref="TimeSpan"/> from the <paramref name="timeSpanString"/>.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// Parsed <see cref="TimeSpan"/>.
|
||||
/// The parsed <see cref="TimeSpan"/>, or <see cref="ArgumentInvalidError"/> if parsing failed.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// If parse wasn't successful, <see cref="TimeSpanParser"/> will return <see cref="ArgumentInvalidError"/>.
|
||||
/// </remarks>
|
||||
public static Result<TimeSpan> TryParse(string timeSpanString)
|
||||
{
|
||||
if (timeSpanString.StartsWith('-'))
|
||||
|
@ -44,7 +41,7 @@ public partial class TimeSpanParser : AbstractTypeParser<TimeSpan>
|
|||
return ParseFromRegex(matches);
|
||||
}
|
||||
|
||||
private static TimeSpan ParseFromRegex(MatchCollection matches)
|
||||
private static Result<TimeSpan> ParseFromRegex(MatchCollection matches)
|
||||
{
|
||||
var timeSpan = TimeSpan.Zero;
|
||||
|
||||
|
@ -59,7 +56,7 @@ public partial class TimeSpanParser : AbstractTypeParser<TimeSpan>
|
|||
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue