1
0
Fork 1
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:
Macintxsh 2024-07-31 12:13:29 +03:00 committed by GitHub
parent 07e8784d2e
commit d6d2660fb0
Signed by: GitHub
GPG key ID: B5690EEEBB952194
9 changed files with 67 additions and 4 deletions

View file

@ -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))