Telegram Bots als eigenständige Entität mit eigener Page

- Neue Tabelle 'telegram_bots' (bot_id, name, bot_token, webhook_secret, is_public)
- Automatische Migration bestehender Session-Telegram-Configs in telegram_bots
- Sessions verweisen via telegram_bot_id auf Bot (mehrere Sessions pro Bot möglich)
- Webhook-URL: /api/telegram/webhook/{botId} statt {sessionId}
- Eigene Telegram-Bot-Page (wie Agent/Cronjob/Session) statt Modal
- Bot-Page: Name, Token, Secret, Webhook-Verwaltung (registrieren/status/entfernen), Löschen
- Dashboard: Telegram Bots Section mit Cards (Name, maskierter Token, Session-Count)
- Session-Page: Bot-Picker (wie Agent-Picker) statt Token-Input, Chat-ID readonly + Unlink-Button
- Public-Flag: Bot kann von anderen Usern in ihren Sessions ausgewählt werden
- Vereinfacht: 1 Session = max. 1 Telegram Chat, allowed_chat_ids entfällt
- /start zeigt Chat-ID an, /unlink entfernt (Unlink nur über Web-UI)
- Nachrichten-Routing: Bot + Chat-ID → Session Lookup
This commit is contained in:
Meleki committed 2026-03-08 19:27:05 +01:00
1 parent 3b7bdb7a20
commit ec73ccd71e
13 files changed
+907 -371

No files matched your search

+1 -3
View File
@@ -14,10 +14,8 @@ public class SessionRecord
public string CustomCommands { get; set; }
public string UserId { get; set; }
public bool IsDeleted { get; set; }
public string TelegramBotToken { get; set; }
public string TelegramWebhookSecret { get; set; }
public string TelegramBotId { get; set; }
public string TelegramChatId { get; set; }
public string TelegramAllowedChatIds { get; set; }
public double AvatarScale { get; set; } = 1.0;
public double AvatarOffsetX { get; set; }
public double AvatarOffsetY { get; set; }
+21
View File
@@ -0,0 +1,21 @@
namespace Gott.Models;
public class TelegramBotRecord
{
public long Id { get; set; }
public string BotId { get; set; }
public string UserId { get; set; }
public string Name { get; set; }
public string BotToken { get; set; }
public string WebhookSecret { get; set; }
public bool IsPublic { get; set; }
public string CreatedAt { get; set; }
public string UpdatedAt { get; set; }
}
public class TelegramBotWithStats
{
public TelegramBotRecord Bot { get; set; }
public int SessionCount { get; set; }
public bool WebhookActive { get; set; }
}