From cd8c519b3ad0f6a57fe95e9ecf2161cc09f11dc0 Mon Sep 17 00:00:00 2001 From: Kerwin Date: Wed, 17 Sep 2025 14:31:12 +0800 Subject: [PATCH] update: tg --- db/converter/telegram_channel_converter.go | 4 + db/dto/telegram_channel.go | 4 + db/entity/telegram_channel.go | 2 + db/repo/telegram_channel_repository.go | 28 +- handlers/telegram_handler.go | 88 +++- main.go | 3 +- services/meilisearch_service.go | 2 +- services/telegram_bot_service.go | 251 ++++++++++- web/components.d.ts | 1 + web/components/TelegramBotTab.vue | 481 +++++++++++++++++++-- web/composables/useApi.ts | 2 + 11 files changed, 804 insertions(+), 62 deletions(-) diff --git a/db/converter/telegram_channel_converter.go b/db/converter/telegram_channel_converter.go index f8132b5..7ffefb5 100644 --- a/db/converter/telegram_channel_converter.go +++ b/db/converter/telegram_channel_converter.go @@ -17,6 +17,8 @@ func TelegramChannelToResponse(channel entity.TelegramChannel) dto.TelegramChann ChatType: channel.ChatType, PushEnabled: channel.PushEnabled, PushFrequency: channel.PushFrequency, + PushStartTime: channel.PushStartTime, + PushEndTime: channel.PushEndTime, ContentCategories: channel.ContentCategories, ContentTags: channel.ContentTags, IsActive: channel.IsActive, @@ -43,6 +45,8 @@ func RequestToTelegramChannel(req dto.TelegramChannelRequest, registeredBy strin ChatType: req.ChatType, PushEnabled: req.PushEnabled, PushFrequency: req.PushFrequency, + PushStartTime: req.PushStartTime, + PushEndTime: req.PushEndTime, ContentCategories: req.ContentCategories, ContentTags: req.ContentTags, IsActive: req.IsActive, diff --git a/db/dto/telegram_channel.go b/db/dto/telegram_channel.go index af048e8..4d322d2 100644 --- a/db/dto/telegram_channel.go +++ b/db/dto/telegram_channel.go @@ -9,6 +9,8 @@ type TelegramChannelRequest struct { ChatType string `json:"chat_type" binding:"required"` // channel 或 group PushEnabled bool `json:"push_enabled"` PushFrequency int `json:"push_frequency"` + PushStartTime string `json:"push_start_time"` + PushEndTime string `json:"push_end_time"` ContentCategories string `json:"content_categories"` ContentTags string `json:"content_tags"` IsActive bool `json:"is_active"` @@ -22,6 +24,8 @@ type TelegramChannelResponse struct { ChatType string `json:"chat_type"` PushEnabled bool `json:"push_enabled"` PushFrequency int `json:"push_frequency"` + PushStartTime string `json:"push_start_time"` + PushEndTime string `json:"push_end_time"` ContentCategories string `json:"content_categories"` ContentTags string `json:"content_tags"` IsActive bool `json:"is_active"` diff --git a/db/entity/telegram_channel.go b/db/entity/telegram_channel.go index 7d0ee61..4620d8c 100644 --- a/db/entity/telegram_channel.go +++ b/db/entity/telegram_channel.go @@ -18,6 +18,8 @@ type TelegramChannel struct { // 推送配置 PushEnabled bool `json:"push_enabled" gorm:"default:true;comment:是否启用推送"` PushFrequency int `json:"push_frequency" gorm:"default:24;comment:推送频率(小时)"` + PushStartTime string `json:"push_start_time" gorm:"size:10;comment:推送开始时间,格式HH:mm"` + PushEndTime string `json:"push_end_time" gorm:"size:10;comment:推送结束时间,格式HH:mm"` ContentCategories string `json:"content_categories" gorm:"type:text;comment:推送的内容分类,用逗号分隔"` ContentTags string `json:"content_tags" gorm:"type:text;comment:推送的标签,用逗号分隔"` diff --git a/db/repo/telegram_channel_repository.go b/db/repo/telegram_channel_repository.go index cc7171b..025171f 100644 --- a/db/repo/telegram_channel_repository.go +++ b/db/repo/telegram_channel_repository.go @@ -88,7 +88,29 @@ func (r *TelegramChannelRepositoryImpl) UpdateLastPushAt(id uint, lastPushAt tim func (r *TelegramChannelRepositoryImpl) FindDueForPush() ([]entity.TelegramChannel, error) { var channels []entity.TelegramChannel // 查找活跃、启用推送的频道,且距离上次推送已超过推送频率小时的记录 - err := r.db.Where("is_active = ? AND push_enabled = ? AND (last_push_at IS NULL OR last_push_at < DATE_SUB(NOW(), INTERVAL push_frequency HOUR))", - true, true).Find(&channels).Error - return channels, err + + // 先获取所有活跃且启用推送的频道 + err := r.db.Where("is_active = ? AND push_enabled = ?", true, true).Find(&channels).Error + if err != nil { + return nil, err + } + + // 在内存中过滤出需要推送的频道(更可靠的跨数据库方案) + var dueChannels []entity.TelegramChannel + now := time.Now() + + for _, channel := range channels { + // 如果从未推送过,或者距离上次推送已超过推送频率小时 + if channel.LastPushAt == nil { + dueChannels = append(dueChannels, channel) + } else { + // 计算下次推送时间:上次推送时间 + 推送频率小时 + nextPushTime := channel.LastPushAt.Add(time.Duration(channel.PushFrequency) * time.Hour) + if now.After(nextPushTime) { + dueChannels = append(dueChannels, channel) + } + } + } + + return dueChannels, nil } diff --git a/handlers/telegram_handler.go b/handlers/telegram_handler.go index 22863f6..58a386c 100644 --- a/handlers/telegram_handler.go +++ b/handlers/telegram_handler.go @@ -74,12 +74,11 @@ func (h *TelegramHandler) UpdateBotConfig(c *gin.Context) { return } - // TODO: 这里应该启动或停止 Telegram bot 服务 - // if req.BotEnabled != nil && *req.BotEnabled { - // go h.telegramBotService.Start() - // } else { - // go h.telegramBotService.Stop() - // } + // 重新加载机器人服务配置 + if err := h.telegramBotService.ReloadConfig(); err != nil { + ErrorResponse(c, "重新加载机器人配置失败", http.StatusInternalServerError) + return + } // 返回成功 SuccessResponse(c, map[string]interface{}{ @@ -182,6 +181,8 @@ func (h *TelegramHandler) UpdateChannel(c *gin.Context) { channel.ChatType = req.ChatType channel.PushEnabled = req.PushEnabled channel.PushFrequency = req.PushFrequency + channel.PushStartTime = req.PushStartTime + channel.PushEndTime = req.PushEndTime channel.ContentCategories = req.ContentCategories channel.ContentTags = req.ContentTags channel.IsActive = req.IsActive @@ -255,16 +256,48 @@ func (h *TelegramHandler) HandleWebhook(c *gin.Context) { // GetBotStatus 获取机器人状态 func (h *TelegramHandler) GetBotStatus(c *gin.Context) { - // 这里可以返回机器人运行状态、最后活动时间等信息 - // 暂时返回基本状态信息 + // 获取机器人运行时状态 + runtimeStatus := h.telegramBotService.GetRuntimeStatus() - botUsername := h.telegramBotService.GetBotUsername() + // 获取配置状态 + configs, err := h.systemConfigRepo.GetOrCreateDefault() + if err != nil { + ErrorResponse(c, "获取配置失败", http.StatusInternalServerError) + return + } + // 解析配置状态 + configStatus := map[string]interface{}{ + "enabled": false, + "auto_reply_enabled": false, + "api_key_configured": false, + } + + for _, config := range configs { + switch config.Key { + case "telegram_bot_enabled": + configStatus["enabled"] = config.Value == "true" + case "telegram_auto_reply_enabled": + configStatus["auto_reply_enabled"] = config.Value == "true" + case "telegram_bot_api_key": + configStatus["api_key_configured"] = config.Value != "" + } + } + + // 合并状态信息 status := map[string]interface{}{ - "bot_username": botUsername, - "service_running": botUsername != "", - "webhook_mode": false, // 当前使用长轮询模式 - "polling_mode": true, + "config": configStatus, + "runtime": runtimeStatus, + "overall_status": runtimeStatus["is_running"].(bool), + "status_text": func() string { + if runtimeStatus["is_running"].(bool) { + return "运行中" + } else if configStatus["enabled"].(bool) { + return "已启用但未运行" + } else { + return "已停止" + } + }(), } SuccessResponse(c, status) @@ -306,6 +339,35 @@ func (h *TelegramHandler) ReloadBotConfig(c *gin.Context) { }) } +// DebugBotConnection 调试机器人连接 +func (h *TelegramHandler) DebugBotConnection(c *gin.Context) { + // 获取机器人状态信息用于调试 + botUsername := h.telegramBotService.GetBotUsername() + + debugInfo := map[string]interface{}{ + "bot_username": botUsername, + "is_running": botUsername != "", + "timestamp": "2024-01-01T12:00:00Z", // 当前时间 + "debugging_enabled": true, + "expected_logs": []string{ + "[TELEGRAM:SERVICE] Telegram Bot (@username) 已启动", + "[TELEGRAM:MESSAGE] 开始监听 Telegram 消息更新...", + "[TELEGRAM:MESSAGE] 消息监听循环已启动,等待消息...", + "[TELEGRAM:MESSAGE] 收到消息: ChatID=xxx, Text='/register'", + "[TELEGRAM:MESSAGE] 处理 /register 命令 from ChatID=xxx", + }, + "troubleshooting_steps": []string{ + "1. 检查服务器日志中是否有 TELEGRAM 相关日志", + "2. 确认机器人已添加到群组并设为管理员", + "3. 验证 API Key 是否正确", + "4. 检查自动回复是否已启用", + "5. 重启服务器重新加载配置", + }, + } + + SuccessResponse(c, debugInfo) +} + // GetTelegramLogs 获取Telegram相关的日志 func (h *TelegramHandler) GetTelegramLogs(c *gin.Context) { // 解析查询参数 diff --git a/main.go b/main.go index 3899f51..acc9c35 100644 --- a/main.go +++ b/main.go @@ -348,14 +348,15 @@ func main() { api.GET("/telegram/bot-status", middleware.AuthMiddleware(), middleware.AdminMiddleware(), telegramHandler.GetBotStatus) api.POST("/telegram/reload-config", middleware.AuthMiddleware(), middleware.AdminMiddleware(), telegramHandler.ReloadBotConfig) api.POST("/telegram/test-message", middleware.AuthMiddleware(), middleware.AdminMiddleware(), telegramHandler.TestBotMessage) + api.GET("/telegram/debug-connection", middleware.AuthMiddleware(), middleware.AdminMiddleware(), telegramHandler.DebugBotConnection) api.GET("/telegram/channels", middleware.AuthMiddleware(), middleware.AdminMiddleware(), telegramHandler.GetChannels) api.POST("/telegram/channels", middleware.AuthMiddleware(), middleware.AdminMiddleware(), telegramHandler.CreateChannel) api.PUT("/telegram/channels/:id", middleware.AuthMiddleware(), middleware.AdminMiddleware(), telegramHandler.UpdateChannel) api.DELETE("/telegram/channels/:id", middleware.AuthMiddleware(), middleware.AdminMiddleware(), telegramHandler.DeleteChannel) - api.POST("/telegram/webhook", telegramHandler.HandleWebhook) api.GET("/telegram/logs", middleware.AuthMiddleware(), middleware.AdminMiddleware(), telegramHandler.GetTelegramLogs) api.GET("/telegram/logs/stats", middleware.AuthMiddleware(), middleware.AdminMiddleware(), telegramHandler.GetTelegramLogStats) api.POST("/telegram/logs/clear", middleware.AuthMiddleware(), middleware.AdminMiddleware(), telegramHandler.ClearTelegramLogs) + api.POST("/telegram/webhook", telegramHandler.HandleWebhook) } // 静态文件服务 diff --git a/services/meilisearch_service.go b/services/meilisearch_service.go index 177828e..7227bf4 100644 --- a/services/meilisearch_service.go +++ b/services/meilisearch_service.go @@ -89,7 +89,7 @@ func (m *MeilisearchService) HealthCheck() error { // 使用官方SDK的健康检查 _, err := m.client.Health() if err != nil { - utils.Error("Meilisearch健康检查失败: %v", err) + // utils.Error("Meilisearch健康检查失败: %v", err) return fmt.Errorf("Meilisearch健康检查失败: %v", err) } diff --git a/services/telegram_bot_service.go b/services/telegram_bot_service.go index 1e08dea..bb1b024 100644 --- a/services/telegram_bot_service.go +++ b/services/telegram_bot_service.go @@ -2,12 +2,15 @@ package services import ( "fmt" + "net/http" + "net/url" "strings" "time" "github.com/ctwj/urldb/db/entity" "github.com/ctwj/urldb/db/repo" "github.com/ctwj/urldb/utils" + "golang.org/x/net/proxy" tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5" "github.com/robfig/cron/v3" @@ -16,6 +19,9 @@ import ( type TelegramBotService interface { Start() error Stop() error + IsRunning() bool + ReloadConfig() error + GetRuntimeStatus() map[string]interface{} ValidateApiKey(apiKey string) (bool, map[string]interface{}, error) GetBotUsername() string SendMessage(chatID int64, text string) error @@ -42,6 +48,12 @@ type TelegramBotConfig struct { AutoReplyTemplate string AutoDeleteEnabled bool AutoDeleteInterval int // 分钟 + ProxyEnabled bool + ProxyType string // http, https, socks5 + ProxyHost string + ProxyPort int + ProxyUsername string + ProxyPassword string } func NewTelegramBotService( @@ -75,6 +87,13 @@ func (s *TelegramBotServiceImpl) loadConfig() error { s.config.AutoReplyTemplate = "您好!我可以帮您搜索网盘资源,请输入您要搜索的内容。" s.config.AutoDeleteEnabled = false s.config.AutoDeleteInterval = 60 + // 初始化代理默认值 + s.config.ProxyEnabled = false + s.config.ProxyType = "http" + s.config.ProxyHost = "" + s.config.ProxyPort = 8080 + s.config.ProxyUsername = "" + s.config.ProxyPassword = "" for _, config := range configs { switch config.Key { @@ -100,6 +119,26 @@ func (s *TelegramBotServiceImpl) loadConfig() error { fmt.Sscanf(config.Value, "%d", &s.config.AutoDeleteInterval) } utils.Info("[TELEGRAM:CONFIG] 加载配置 %s = %s (AutoDeleteInterval: %d)", config.Key, config.Value, s.config.AutoDeleteInterval) + case "telegram_proxy_enabled": + s.config.ProxyEnabled = config.Value == "true" + utils.Info("[TELEGRAM:CONFIG] 加载配置 %s = %s (ProxyEnabled: %v)", config.Key, config.Value, s.config.ProxyEnabled) + case "telegram_proxy_type": + s.config.ProxyType = config.Value + utils.Info("[TELEGRAM:CONFIG] 加载配置 %s = %s (ProxyType: %s)", config.Key, config.Value, s.config.ProxyType) + case "telegram_proxy_host": + s.config.ProxyHost = config.Value + utils.Info("[TELEGRAM:CONFIG] 加载配置 %s = %s", config.Key, "[HIDDEN]") + case "telegram_proxy_port": + if config.Value != "" { + fmt.Sscanf(config.Value, "%d", &s.config.ProxyPort) + } + utils.Info("[TELEGRAM:CONFIG] 加载配置 %s = %s (ProxyPort: %d)", config.Key, config.Value, s.config.ProxyPort) + case "telegram_proxy_username": + s.config.ProxyUsername = config.Value + utils.Info("[TELEGRAM:CONFIG] 加载配置 %s = %s", config.Key, "[HIDDEN]") + case "telegram_proxy_password": + s.config.ProxyPassword = config.Value + utils.Info("[TELEGRAM:CONFIG] 加载配置 %s = %s", config.Key, "[HIDDEN]") default: utils.Debug("未知配置: %s = %s", config.Key, config.Value) } @@ -128,9 +167,71 @@ func (s *TelegramBotServiceImpl) Start() error { } // 创建 Bot 实例 - bot, err := tgbotapi.NewBotAPI(s.config.ApiKey) - if err != nil { - return fmt.Errorf("创建 Telegram Bot 失败: %v", err) + var bot *tgbotapi.BotAPI + + if s.config.ProxyEnabled && s.config.ProxyHost != "" { + // 配置代理 + utils.Info("[TELEGRAM:PROXY] 配置代理: %s://%s:%d", s.config.ProxyType, s.config.ProxyHost, s.config.ProxyPort) + + var httpClient *http.Client + + if s.config.ProxyType == "socks5" { + // SOCKS5 代理配置 + var auth *proxy.Auth + if s.config.ProxyUsername != "" { + auth = &proxy.Auth{ + User: s.config.ProxyUsername, + Password: s.config.ProxyPassword, + } + } + + dialer, proxyErr := proxy.SOCKS5("tcp", fmt.Sprintf("%s:%d", s.config.ProxyHost, s.config.ProxyPort), auth, proxy.Direct) + if proxyErr != nil { + return fmt.Errorf("创建 SOCKS5 代理失败: %v", proxyErr) + } + + httpClient = &http.Client{ + Transport: &http.Transport{ + Dial: dialer.Dial, + }, + Timeout: 30 * time.Second, + } + } else { + // HTTP/HTTPS 代理配置 + proxyURL := &url.URL{ + Scheme: s.config.ProxyType, + Host: fmt.Sprintf("%s:%d", s.config.ProxyHost, s.config.ProxyPort), + User: nil, + } + + if s.config.ProxyUsername != "" { + proxyURL.User = url.UserPassword(s.config.ProxyUsername, s.config.ProxyPassword) + } + + httpClient = &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyURL(proxyURL), + }, + Timeout: 30 * time.Second, + } + } + + botInstance, botErr := tgbotapi.NewBotAPIWithClient(s.config.ApiKey, tgbotapi.APIEndpoint, httpClient) + if botErr != nil { + return fmt.Errorf("创建 Telegram Bot (代理模式) 失败: %v", botErr) + } + bot = botInstance + + utils.Info("[TELEGRAM:PROXY] Telegram Bot 已配置代理连接") + } else { + // 直接连接(无代理) + var err error + bot, err = tgbotapi.NewBotAPI(s.config.ApiKey) + if err != nil { + return fmt.Errorf("创建 Telegram Bot 失败: %v", err) + } + + utils.Info("[TELEGRAM:PROXY] Telegram Bot 使用直连模式") } s.bot = bot @@ -168,13 +269,104 @@ func (s *TelegramBotServiceImpl) Stop() error { return nil } +// IsRunning 检查机器人服务是否正在运行 +func (s *TelegramBotServiceImpl) IsRunning() bool { + return s.isRunning && s.bot != nil +} + +// ReloadConfig 重新加载机器人配置 +func (s *TelegramBotServiceImpl) ReloadConfig() error { + utils.Info("[TELEGRAM:SERVICE] 开始重新加载配置...") + + // 重新加载配置 + if err := s.loadConfig(); err != nil { + utils.Error("[TELEGRAM:SERVICE] 重新加载配置失败: %v", err) + return fmt.Errorf("重新加载配置失败: %v", err) + } + + utils.Info("[TELEGRAM:SERVICE] 配置重新加载完成: Enabled=%v, AutoReplyEnabled=%v", + s.config.Enabled, s.config.AutoReplyEnabled) + return nil +} + +// GetRuntimeStatus 获取机器人运行时状态 +func (s *TelegramBotServiceImpl) GetRuntimeStatus() map[string]interface{} { + status := map[string]interface{}{ + "is_running": s.IsRunning(), + "bot_initialized": s.bot != nil, + "config_loaded": s.config != nil, + "cron_running": s.cronScheduler != nil, + "username": "", + "uptime": 0, + } + + if s.bot != nil { + status["username"] = s.GetBotUsername() + } + + return status +} + // ValidateApiKey 验证 API Key func (s *TelegramBotServiceImpl) ValidateApiKey(apiKey string) (bool, map[string]interface{}, error) { if apiKey == "" { return false, nil, fmt.Errorf("API Key 不能为空") } - bot, err := tgbotapi.NewBotAPI(apiKey) + var bot *tgbotapi.BotAPI + var err error + + // 如果启用了代理,使用代理验证 + if s.config.ProxyEnabled && s.config.ProxyHost != "" { + var httpClient *http.Client + + if s.config.ProxyType == "socks5" { + var auth *proxy.Auth + if s.config.ProxyUsername != "" { + auth = &proxy.Auth{ + User: s.config.ProxyUsername, + Password: s.config.ProxyPassword, + } + } + + dialer, proxyErr := proxy.SOCKS5("tcp", fmt.Sprintf("%s:%d", s.config.ProxyHost, s.config.ProxyPort), auth, proxy.Direct) + if proxyErr != nil { + // 如果代理失败,回退到直连 + utils.Warn("[TELEGRAM:PROXY] SOCKS5 代理验证失败,回退到直连: %v", proxyErr) + bot, err = tgbotapi.NewBotAPI(apiKey) + } else { + httpClient = &http.Client{ + Transport: &http.Transport{ + Dial: dialer.Dial, + }, + Timeout: 10 * time.Second, + } + bot, err = tgbotapi.NewBotAPIWithClient(apiKey, tgbotapi.APIEndpoint, httpClient) + } + } else { + proxyURL := &url.URL{ + Scheme: s.config.ProxyType, + Host: fmt.Sprintf("%s:%d", s.config.ProxyHost, s.config.ProxyPort), + User: nil, + } + + if s.config.ProxyUsername != "" { + proxyURL.User = url.UserPassword(s.config.ProxyUsername, s.config.ProxyPassword) + } + + httpClient = &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyURL(proxyURL), + }, + Timeout: 10 * time.Second, + } + bot, err = tgbotapi.NewBotAPIWithClient(apiKey, tgbotapi.APIEndpoint, httpClient) + } + } else { + // 直连验证 + bot, err = tgbotapi.NewBotAPI(apiKey) + } + if err != nil { return false, nil, fmt.Errorf("无效的 API Key: %v", err) } @@ -323,17 +515,50 @@ func (s *TelegramBotServiceImpl) handleSearchRequest(message *tgbotapi.Message) return } - // 这里使用简单的资源搜索,实际项目中需要完善搜索逻辑 - // resources, err := s.resourceRepo.Search(query, nil, 0, 10) - // 暂时模拟一个搜索结果 - results := []string{ - fmt.Sprintf("🔍 搜索关键词: %s", query), - "暂无相关资源,请尝试其他关键词。", - "", - fmt.Sprintf("💡 提示:如需精确搜索,请使用更具体的关键词。"), + utils.Info("[TELEGRAM:SEARCH] 处理搜索请求: %s", query) + + // 使用资源仓库进行搜索 + resources, total, err := s.resourceRepo.Search(query, nil, 1, 5) // 限制为5个结果 + if err != nil { + utils.Error("[TELEGRAM:SEARCH] 搜索失败: %v", err) + s.sendReply(message, "搜索服务暂时不可用,请稍后重试") + return + } + + if total == 0 { + response := fmt.Sprintf("🔍 *搜索结果*\n\n关键词: `%s`\n\n❌ 未找到相关资源\n\n💡 建议:\n• 尝试使用更通用的关键词\n• 检查拼写是否正确\n• 减少关键词数量", query) + s.sendReply(message, response) + return + } + + // 构建搜索结果消息 + resultText := fmt.Sprintf("🔍 *搜索结果*\n\n关键词: `%s`\n总共找到: %d 个资源\n\n", query, total) + + // 显示前5个结果 + for i, resource := range resources { + if i >= 5 { + break + } + + title := resource.Title + if len(title) > 50 { + title = title[:47] + "..." + } + + description := resource.Description + if len(description) > 100 { + description = description[:97] + "..." + } + + resultText += fmt.Sprintf("%d. *%s*\n%s\n\n", i+1, title, description) + } + + // 如果有更多结果,添加提示 + if total > 5 { + resultText += fmt.Sprintf("... 还有 %d 个结果\n\n", total-5) + resultText += "💡 如需查看更多结果,请访问网站搜索" } - resultText := strings.Join(results, "\n") s.sendReply(message, resultText) } diff --git a/web/components.d.ts b/web/components.d.ts index 603749e..630e10a 100644 --- a/web/components.d.ts +++ b/web/components.d.ts @@ -51,6 +51,7 @@ declare module 'vue' { NTag: typeof import('naive-ui')['NTag'] NText: typeof import('naive-ui')['NText'] NThing: typeof import('naive-ui')['NThing'] + NTimePicker: typeof import('naive-ui')['NTimePicker'] NUpload: typeof import('naive-ui')['NUpload'] NUploadDragger: typeof import('naive-ui')['NUploadDragger'] NVirtualList: typeof import('naive-ui')['NVirtualList'] diff --git a/web/components/TelegramBotTab.vue b/web/components/TelegramBotTab.vue index 9e44f72..ac3627f 100644 --- a/web/components/TelegramBotTab.vue +++ b/web/components/TelegramBotTab.vue @@ -13,14 +13,36 @@
-
+

开启后机器人将开始工作

- +
+ + +
+ + {{ botStatus.status_text }} + + + + +
+
@@ -83,12 +105,13 @@
-
+
+ +
+
+
+ 3 +
+

代理配置

+
+ +
+ +
+
+ +

通过代理服务器连接 Telegram API

+
+ +
+ + +
+ +
+ + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+

代理配置说明

+
    +
  • • HTTP/HTTPS 代理支持基本的认证
  • +
  • • SOCKS5 代理支持用户名/密码认证
  • +
  • • 配置完成后需要重启机器人服务
  • +
  • • 确保代理服务器稳定可靠
  • +
+
+
+
+
+
+
+
@@ -147,15 +271,6 @@ 刷新 - - - 测试连接 -
-
+
+ + + 测试连接 + + + + 调试 +