Browse Source

Removed my "Timespanext" class.

In my current code base, I created a "Wrapper" class to trick the command parser into using a custom type reader, instead of the built-in timespan parser. I forgot to remove those pieces for the initial edit.
pull/1131/head
ericmck2000 GitHub 7 years ago
parent
commit
61b3882929
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/Discord.Net.Commands/Readers/TimeSpanTypeReader.cs

+ 3
- 3
src/Discord.Net.Commands/Readers/TimeSpanTypeReader.cs View File

@@ -33,10 +33,10 @@ namespace Discord.Commands

//First, try using the built-in TimeSpan.Parse. (Default Implementation)
if (TimeSpan.TryParseExact(data, _formats, CultureInfo.InvariantCulture, out TimeSpan timeSpan))
return Task.FromResult(TypeReaderResult.FromSuccess(new TimeSpanext(timeSpan)));
//@XtremeOwnage - Try using the regular TimeSpan.TryPrase
return Task.FromResult(TypeReaderResult.FromSuccess(timeSpan));
//@ericmck2000 - Try using the regular TimeSpan.TryPrase. Greatly improves success rate.
else if (TimeSpan.TryParse(data, out TimeSpan Time))
return Task.FromResult(TypeReaderResult.FromSuccess(new TimeSpanext(Time)));
return Task.FromResult(TypeReaderResult.FromSuccess(Time));
else
{
return Task.FromResult(TypeReaderResult.FromError(CommandError.ParseFailed, "Failed to parse TimeSpan"));


Loading…
Cancel
Save