littleshop/LittleShop/DTOs/BotDiscoveryDto.cs
SysAdmin 86f19ba044
All checks were successful
Build and Deploy LittleShop / Deploy to Pre-Production (CT109) (push) Successful in 59s
Build and Deploy LittleShop / Deploy to Production VPS (Manual Only) (push) Has been skipped
feat: Add AlexHost deployment pipeline and bot control functionality
- Add Gitea Actions workflow for manual AlexHost deployment
- Add docker-compose.alexhost.yml for production deployment
- Add deploy-alexhost.sh script with server-side build support
- Add Bot Control feature (Start/Stop/Restart) for remote bot management
- Add discovery control endpoint in TeleBot
- Update TeleBot with StartPollingAsync/StopPolling/RestartPollingAsync
- Fix platform architecture issues by building on target server
- Update docker-compose configurations for all environments

Deployment tested successfully:
- TeleShop: healthy at https://teleshop.silentmary.mywire.org
- TeleBot: healthy with discovery integration
- SilverPay: connectivity verified

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 12:33:46 +00:00

166 lines
4.5 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace LittleShop.DTOs;
/// <summary>
/// Input for discovering a remote TeleBot instance
/// </summary>
public class RemoteBotDiscoveryDto
{
[Required]
[StringLength(255)]
public string IpAddress { get; set; } = string.Empty;
[Range(1, 65535)]
public int Port { get; set; } = 5010;
}
/// <summary>
/// Response from TeleBot's discovery probe endpoint
/// </summary>
public class DiscoveryProbeResponse
{
public string InstanceId { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string Version { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public bool HasToken { get; set; }
public bool IsConfigured { get; set; }
public bool IsInitialized { get; set; }
public string? TelegramUsername { get; set; }
public DateTime Timestamp { get; set; }
}
/// <summary>
/// Input for registering a discovered remote bot
/// </summary>
public class RemoteBotRegistrationDto
{
[Required]
[StringLength(255)]
public string IpAddress { get; set; } = string.Empty;
[Range(1, 65535)]
public int Port { get; set; } = 5010;
[Required]
[StringLength(100)]
public string Name { get; set; } = string.Empty;
[StringLength(500)]
public string Description { get; set; } = string.Empty;
[StringLength(50)]
public string PersonalityName { get; set; } = string.Empty;
/// <summary>
/// Instance ID from the discovery probe response
/// </summary>
public string? RemoteInstanceId { get; set; }
}
/// <summary>
/// Input for configuring a remote bot with Telegram credentials
/// </summary>
public class RemoteBotConfigureDto
{
[Required]
public Guid BotId { get; set; }
[Required]
public string BotToken { get; set; } = string.Empty;
public Dictionary<string, object>? Settings { get; set; }
}
/// <summary>
/// Result of a discovery probe operation
/// </summary>
public class DiscoveryResult
{
public bool Success { get; set; }
public string Message { get; set; } = string.Empty;
public DiscoveryProbeResponse? ProbeResponse { get; set; }
}
/// <summary>
/// Result of initializing a remote bot
/// </summary>
public class InitializeResult
{
public bool Success { get; set; }
public string Message { get; set; } = string.Empty;
public string? InstanceId { get; set; }
}
/// <summary>
/// Result of configuring a remote bot
/// </summary>
public class ConfigureResult
{
public bool Success { get; set; }
public string Message { get; set; } = string.Empty;
public string? TelegramUsername { get; set; }
public string? TelegramDisplayName { get; set; }
public string? TelegramId { get; set; }
}
/// <summary>
/// View model for the discovery wizard
/// </summary>
public class DiscoveryWizardViewModel
{
// Step 1: Discovery
public string IpAddress { get; set; } = string.Empty;
public int Port { get; set; } = 5010;
// Step 2: Registration (populated after probe)
public DiscoveryProbeResponse? ProbeResponse { get; set; }
public string BotName { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string PersonalityName { get; set; } = string.Empty;
// Step 3: Configuration (populated after registration)
public Guid? BotId { get; set; }
public string? BotKey { get; set; }
public string BotToken { get; set; } = string.Empty;
// Step tracking
public int CurrentStep { get; set; } = 1;
public string? ErrorMessage { get; set; }
public string? SuccessMessage { get; set; }
}
/// <summary>
/// Discovery status constants
/// </summary>
public static class DiscoveryStatus
{
public const string Local = "Local";
public const string AwaitingDiscovery = "AwaitingDiscovery";
public const string Discovered = "Discovered";
public const string Initialized = "Initialized";
public const string Configured = "Configured";
public const string Offline = "Offline";
public const string Error = "Error";
}
/// <summary>
/// Result of a bot control action (start/stop/restart)
/// </summary>
public class BotControlResult
{
public bool Success { get; set; }
public string Message { get; set; } = string.Empty;
/// <summary>
/// Current bot status after the action
/// </summary>
public string Status { get; set; } = string.Empty;
/// <summary>
/// Whether Telegram polling is currently running
/// </summary>
public bool IsRunning { get; set; }
}