Add /resetsettings (#111)

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Macintxsh 2023-09-22 20:23:08 +03:00 committed by GitHub
parent d6e1468f3e
commit 3a3865ba3d
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 112 additions and 0 deletions

View file

@ -8,4 +8,5 @@ public interface IOption
string Name { get; }
string Display(JsonNode settings);
Result Set(JsonNode settings, string from);
Result Reset(JsonNode settings);
}

View file

@ -48,4 +48,10 @@ public class Option<T> : IOption
var property = settings[Name];
return property != null ? property.GetValue<T>() : DefaultValue;
}
public Result Reset(JsonNode settings)
{
settings[Name] = null;
return Result.FromSuccess();
}
}