littleshop/TeleBot/TeleBot/DTOs/DiscoveryDtos.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

168 lines
4.3 KiB
C#

using System.Text.Json.Serialization;
namespace TeleBot.DTOs;
/// <summary>
/// Response returned when LittleShop probes this TeleBot instance
/// </summary>
public class DiscoveryProbeResponse
{
/// <summary>
/// Unique identifier for this TeleBot instance (generated on first startup)
/// </summary>
public string InstanceId { get; set; } = string.Empty;
/// <summary>
/// Configured name of this bot
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// TeleBot version
/// </summary>
public string Version { get; set; } = string.Empty;
/// <summary>
/// Current operational status
/// </summary>
public string Status { get; set; } = "Bootstrap";
/// <summary>
/// Whether a Telegram bot token has been configured
/// </summary>
public bool HasToken { get; set; }
/// <summary>
/// Whether the bot is fully configured and operational
/// </summary>
public bool IsConfigured { get; set; }
/// <summary>
/// Whether this instance has been initialized (has BotKey)
/// </summary>
public bool IsInitialized { get; set; }
/// <summary>
/// Telegram username if configured and operational
/// </summary>
public string? TelegramUsername { get; set; }
/// <summary>
/// Timestamp of probe response
/// </summary>
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
}
/// <summary>
/// Request to initialize this TeleBot instance from LittleShop
/// </summary>
public class DiscoveryInitializeRequest
{
/// <summary>
/// Bot key assigned by LittleShop for authentication
/// </summary>
public string BotKey { get; set; } = string.Empty;
/// <summary>
/// Secret for webhook authentication
/// </summary>
public string WebhookSecret { get; set; } = string.Empty;
/// <summary>
/// LittleShop API URL (if different from discovery source)
/// </summary>
public string? LittleShopUrl { get; set; }
}
/// <summary>
/// Response after initialization
/// </summary>
public class DiscoveryInitializeResponse
{
public bool Success { get; set; }
public string Message { get; set; } = string.Empty;
public string? InstanceId { get; set; }
}
/// <summary>
/// Request to configure this TeleBot instance with Telegram credentials
/// </summary>
public class DiscoveryConfigureRequest
{
/// <summary>
/// Telegram Bot token from BotFather
/// </summary>
public string BotToken { get; set; } = string.Empty;
/// <summary>
/// Additional settings to apply
/// </summary>
public Dictionary<string, object>? Settings { get; set; }
}
/// <summary>
/// Response after configuration
/// </summary>
public class DiscoveryConfigureResponse
{
public bool Success { get; set; }
public string Message { get; set; } = string.Empty;
/// <summary>
/// Telegram bot username (e.g., @MyBot)
/// </summary>
public string? TelegramUsername { get; set; }
/// <summary>
/// Telegram bot display name
/// </summary>
public string? TelegramDisplayName { get; set; }
/// <summary>
/// Telegram bot ID
/// </summary>
public string? TelegramId { get; set; }
}
/// <summary>
/// Status update sent to indicate bot operational state
/// </summary>
public class BotStatusUpdate
{
public string Status { get; set; } = "Unknown";
public bool IsOperational { get; set; }
public int ActiveSessions { get; set; }
public DateTime LastActivityAt { get; set; }
public Dictionary<string, object>? Metadata { get; set; }
}
/// <summary>
/// Request to control the bot (start/stop/restart)
/// </summary>
public class BotControlRequest
{
/// <summary>
/// Control action: "start", "stop", or "restart"
/// </summary>
public string Action { get; set; } = string.Empty;
}
/// <summary>
/// Response after a control action
/// </summary>
public class BotControlResponse
{
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; }
}