forked from TeamInklings/Octobot
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:
parent
d6e1468f3e
commit
3a3865ba3d
7 changed files with 112 additions and 0 deletions
|
@ -8,4 +8,5 @@ public interface IOption
|
|||
string Name { get; }
|
||||
string Display(JsonNode settings);
|
||||
Result Set(JsonNode settings, string from);
|
||||
Result Reset(JsonNode settings);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue