@model IEnumerable @{ ViewData["Title"] = "Bot Management"; }

Bot Management

Create Telegram Bot (Wizard) Manual Registration

@{ // Detect duplicates by platform username var duplicateGroups = Model .Where(b => !string.IsNullOrEmpty(b.PlatformUsername)) .GroupBy(b => b.PlatformUsername) .Where(g => g.Count() > 1) .ToList(); if (duplicateGroups.Any()) {
Duplicate Bots Detected

Found @duplicateGroups.Count duplicate bot group(s) with multiple entries for the same Telegram username.

This usually happens when the bot container restarts without a saved API key. The system now prevents this automatically.

@foreach (var group in duplicateGroups) {
@@@group.Key (@group.Count() entries)
@foreach (var bot in group.OrderByDescending(b => b.LastSeenAt ?? b.CreatedAt)) { var isNewest = bot == group.OrderByDescending(b => b.LastSeenAt ?? b.CreatedAt).First(); }
Created Last Seen Status Sessions Action
@bot.CreatedAt.ToString("yyyy-MM-dd HH:mm") @if (bot.LastSeenAt.HasValue) { @bot.LastSeenAt.Value.ToString("yyyy-MM-dd HH:mm") } else { Never } @bot.Status @bot.TotalSessions @if (isNewest) { Keep (Most Recent) } else {
@Html.AntiForgeryToken()
}
}
} } @if (TempData["Success"] != null) { } @if (TempData["Error"] != null) { }
@foreach (var bot in Model) { }
Name Type Platform Info Status Active Sessions Total Revenue Last Seen Created Actions
@bot.Name @if (!string.IsNullOrEmpty(bot.PersonalityName)) { @bot.PersonalityName } @if (!string.IsNullOrEmpty(bot.Description)) {
@bot.Description }
@bot.Type @if (!string.IsNullOrEmpty(bot.PlatformUsername)) {
@@@bot.PlatformUsername @if (!string.IsNullOrEmpty(bot.PlatformDisplayName)) {
@bot.PlatformDisplayName }
} else { Not configured }
@switch (bot.Status) { case LittleShop.Enums.BotStatus.Active: Active break; case LittleShop.Enums.BotStatus.Inactive: Inactive break; case LittleShop.Enums.BotStatus.Suspended: Suspended break; case LittleShop.Enums.BotStatus.Maintenance: Maintenance break; default: @bot.Status break; } @bot.ActiveSessions $@bot.TotalRevenue.ToString("F2") @if (bot.LastSeenAt.HasValue) { @((DateTime.UtcNow - bot.LastSeenAt.Value).TotalMinutes < 5 ? "Online" : bot.LastSeenAt.Value.ToString("yyyy-MM-dd HH:mm")) @if ((DateTime.UtcNow - bot.LastSeenAt.Value).TotalMinutes < 5) { } } else { Never } @bot.CreatedAt.ToString("yyyy-MM-dd")
@if (!Model.Any()) {
No bots have been registered yet. Register your first bot.
}