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