mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-18 16:03:36 +03:00
add override for TimeSpanOption
This commit is contained in:
parent
518238ac1b
commit
4eca50edf8
1 changed files with 10 additions and 0 deletions
|
@ -8,6 +8,16 @@ public sealed class TimeSpanOption : GuildOption<TimeSpan>
|
|||
{
|
||||
public TimeSpanOption(string name, TimeSpan defaultValue) : base(name, defaultValue) { }
|
||||
|
||||
public override Result<bool> ValueEquals(JsonNode settings, string value)
|
||||
{
|
||||
if (!TimeSpanParser.TryParse(value).IsDefined(out var span))
|
||||
{
|
||||
return new ArgumentInvalidError(nameof(value), Messages.InvalidSettingValue);
|
||||
}
|
||||
|
||||
return Value(settings).Equals(span.ToString());
|
||||
}
|
||||
|
||||
public override TimeSpan Get(JsonNode settings)
|
||||
{
|
||||
var property = settings[Name];
|
||||
|
|
Loading…
Add table
Reference in a new issue