优化sdk

This commit is contained in:
sky22333
2026-03-17 23:21:27 +08:00
parent da0586b5ca
commit af647f979b
10 changed files with 260 additions and 65 deletions
+23
View File
@@ -0,0 +1,23 @@
package qqbot
import (
"path/filepath"
"testing"
"github.com/sky22333/qqbot/config"
)
func TestNewWithOptionsWithoutCollector(t *testing.T) {
cfg := config.Default()
cfg.QQBot.AppID = "123"
cfg.QQBot.ClientSecret = "secret"
cfg.Server.ListenAddr = ""
cfg.Server.MaxBodyBytes = 0
cfg.Targets.FilePath = filepath.Join(t.TempDir(), "targets.json")
client, err := NewWithOptions(cfg, ClientOptions{StartCollector: false})
if err != nil {
t.Fatalf("创建客户端失败: %v", err)
}
client.Close()
}