feat(sender/onebot): 新增onebot协议支持

This commit is contained in:
mei
2026-03-01 15:27:45 +08:00
parent e68d48e816
commit 4f305cfeda
19 changed files with 214 additions and 245 deletions
+36
View File
@@ -0,0 +1,36 @@
package sender
import (
"log"
"time"
"github.com/ssdomei232/goodBaby/configs"
"github.com/ssdomei232/goodBaby/pkg/github"
)
// 将repos设置为public
func Github() {
config, err := configs.GetConfig()
if err != nil {
log.Fatalln(err)
}
for _, repo := range config.GithubConfig.Repos {
maxRetries := 10
for attempt := range maxRetries {
err := github.MakeRepositoryPublic(config.GithubConfig.Owner, repo, config.GithubConfig.Token)
if err == nil {
break
}
log.Printf("尝试设置仓库 %s 为公开失败 (尝试 %d/%d): %v", repo, attempt+1, maxRetries, err)
// 如果不是最后一次尝试,则等待一段时间后重试
if attempt < maxRetries-1 {
time.Sleep(time.Duration(attempt+1) * time.Second) // 逐步增加等待时间
} else {
log.Printf("设置仓库 %s 为公开最终失败", repo)
}
}
}
}