2024-07-16 00:48:55 -04:00
using HermesSocketLibrary.Socket.Data ;
2024-06-16 20:19:31 -04:00
using Serilog ;
2024-07-16 00:48:55 -04:00
using TwitchChatTTS.Hermes.Socket ;
2024-08-06 15:29:29 -04:00
using TwitchChatTTS.Twitch.Socket ;
2024-08-04 19:46:10 -04:00
using TwitchChatTTS.Twitch.Socket.Messages ;
2024-07-19 12:56:41 -04:00
using static TwitchChatTTS . Chat . Commands . TTSCommands ;
2024-06-16 20:19:31 -04:00
namespace TwitchChatTTS.Chat.Commands
{
2024-07-19 12:56:41 -04:00
public class VersionCommand : IChatCommand
2024-06-16 20:19:31 -04:00
{
2024-07-16 00:48:55 -04:00
private readonly User _user ;
2024-06-16 20:19:31 -04:00
private ILogger _logger ;
2024-07-19 12:56:41 -04:00
public string Name = > "version" ;
2024-07-16 00:48:55 -04:00
public VersionCommand ( User user , ILogger logger )
2024-06-16 20:19:31 -04:00
{
2024-07-16 00:48:55 -04:00
_user = user ;
2024-06-16 20:19:31 -04:00
_logger = logger ;
}
2024-07-19 12:56:41 -04:00
public void Build ( ICommandBuilder builder )
2024-06-16 20:19:31 -04:00
{
2024-07-19 12:56:41 -04:00
builder . CreateCommandTree ( Name , b = > b . CreateCommand ( new AppVersionCommand ( _user , _logger ) ) ) ;
2024-06-16 20:19:31 -04:00
}
2024-07-19 12:56:41 -04:00
private sealed class AppVersionCommand : IChatPartialCommand
2024-06-16 20:19:31 -04:00
{
2024-07-19 12:56:41 -04:00
private readonly User _user ;
private ILogger _logger ;
public bool AcceptCustomPermission { get = > true ; }
public AppVersionCommand ( User user , ILogger logger )
{
_user = user ;
_logger = logger ;
}
2024-08-06 15:29:29 -04:00
public async Task Execute ( IDictionary < string , string > values , ChannelChatMessage message , HermesSocketClient hermes )
2024-07-19 12:56:41 -04:00
{
_logger . Information ( $"TTS Version: {TTS.MAJOR_VERSION}.{TTS.MINOR_VERSION}" ) ;
2024-07-16 00:48:55 -04:00
2024-08-06 15:29:29 -04:00
await hermes . SendLoggingMessage ( HermesLoggingLevel . Info , $"{_user.TwitchUsername} [twitch id: {_user.TwitchUserId}] using version {TTS.MAJOR_VERSION}.{TTS.MINOR_VERSION}." ) ;
2024-07-19 12:56:41 -04:00
}
2024-06-16 20:19:31 -04:00
}
}
}