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