1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-03 20:49:54 +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

@ -21,9 +21,19 @@ public class GuildOption<T> : IGuildOption
public string Name { get; }
protected virtual string Value(JsonNode settings)
{
return Get(settings).ToString() ?? throw new InvalidOperationException();
}
public virtual string Display(JsonNode settings)
{
return Markdown.InlineCode(Get(settings).ToString() ?? throw new InvalidOperationException());
return Markdown.InlineCode(Value(settings));
}
public virtual Result<bool> ValueEquals(JsonNode settings, string value)
{
return Value(settings).Equals(value);
}
/// <summary>