mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-01 19:49:55 +03:00
Show an error when entering the same value from the settings (#326)
Closes #324
This commit is contained in:
parent
07e8784d2e
commit
d6d2660fb0
9 changed files with 67 additions and 4 deletions
|
@ -12,6 +12,16 @@ public sealed class BoolOption : GuildOption<bool>
|
|||
return Get(settings) ? Messages.Yes : Messages.No;
|
||||
}
|
||||
|
||||
public override Result<bool> ValueEquals(JsonNode settings, string value)
|
||||
{
|
||||
if (!TryParseBool(value, out var boolean))
|
||||
{
|
||||
return new ArgumentInvalidError(nameof(value), Messages.InvalidSettingValue);
|
||||
}
|
||||
|
||||
return Value(settings).Equals(boolean.ToString());
|
||||
}
|
||||
|
||||
public override Result Set(JsonNode settings, string from)
|
||||
{
|
||||
if (!TryParseBool(from, out var value))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue