2024-03-15 08:27:35 -04:00
|
|
|
namespace TwitchChatTTS.Chat.Commands.Parameters
|
|
|
|
{
|
|
|
|
public class TTSVoiceNameParameter : ChatCommandParameter
|
|
|
|
{
|
2024-06-24 18:11:36 -04:00
|
|
|
private readonly User _user;
|
2024-03-15 08:27:35 -04:00
|
|
|
|
2024-06-24 18:11:36 -04:00
|
|
|
public TTSVoiceNameParameter(User user, bool optional = false) : base("TTS Voice Name", "Name of a TTS voice", optional)
|
2024-03-15 08:27:35 -04:00
|
|
|
{
|
2024-06-24 18:11:36 -04:00
|
|
|
_user = user;
|
2024-03-15 08:27:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public override bool Validate(string value)
|
|
|
|
{
|
2024-06-24 18:11:36 -04:00
|
|
|
if (_user.VoicesAvailable == null)
|
2024-03-15 08:27:35 -04:00
|
|
|
return false;
|
|
|
|
|
|
|
|
value = value.ToLower();
|
2024-06-24 18:11:36 -04:00
|
|
|
return _user.VoicesAvailable.Any(e => e.Value.ToLower() == value);
|
2024-03-15 08:27:35 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|