1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-01-31 17:19:00 +03:00
Octobot/TeamOctolings.Octobot/Data/Options/PunishmentOption.cs

24 lines
712 B
C#
Raw Normal View History

using System.Text.Json.Nodes;
using Remora.Results;
2024-06-02 07:56:12 +03:00
namespace TeamOctolings.Octobot.Data.Options;
/// <inheritdoc />
2024-06-02 07:56:12 +03:00
public sealed class PunishmentOption : GuildOption<string>
{
private static readonly List<string> AllowedValues =
[
"ban", "kick", "mute", "off", "disable", "disabled"
];
public PunishmentOption(string name, string defaultValue) : base(name, defaultValue) { }
/// <inheritdoc />
public override Result Set(JsonNode settings, string from)
{
return AllowedValues.Contains(from.ToLowerInvariant())
? base.Set(settings, from.ToLowerInvariant())
: new ArgumentInvalidError(nameof(from), Messages.InvalidWarnPunishment);
}
}