diff --git a/action/group_member.go b/action/group_member.go index 701b4f4..cd57913 100644 --- a/action/group_member.go +++ b/action/group_member.go @@ -12,7 +12,7 @@ import ( ) func GetGroupMemberList(groupID int64) ([]model.GroupMember, error) { - fullURL := fmt.Sprintf("http://%s%s?group_id=%d", config.ConfigManager.GetConfig().NapcatHttpSrv, constants.GET_GROUP_MEMBER_LIST, groupID) + fullURL := fmt.Sprintf("http://%s%s?group_id=%d", config.ConfigManager.GetConfig().Management.NapcatHttpSrv, constants.GET_GROUP_MEMBER_LIST, groupID) response, err := http.Get(fullURL) if err != nil { @@ -35,7 +35,7 @@ func GetGroupMemberList(groupID int64) ([]model.GroupMember, error) { } func GetGroupList() ([]model.Group, error) { - fullURL := fmt.Sprintf("http://%s%s", config.ConfigManager.GetConfig().NapcatHttpSrv, constants.GET_GROUP_LIST) + fullURL := fmt.Sprintf("http://%s%s", config.ConfigManager.GetConfig().Management.NapcatHttpSrv, constants.GET_GROUP_LIST) response, err := http.Get(fullURL) if err != nil { diff --git a/config/config.go b/config/config.go index f3d6bab..1c52018 100644 --- a/config/config.go +++ b/config/config.go @@ -9,16 +9,19 @@ import ( var ConfigManager = &configManager{} type Config struct { - Admin int64 `yaml:"admin"` SteamApiKey string `yaml:"steam_api_key"` - ProxyAddr string `yaml:"proxy_addr"` - NapcatWsSrv string `yaml:"napcat_ws_srv"` - NapcatHttpSrv string `yaml:"napcat_http_srv"` OpenaiApiKey string `yaml:"openai_api_key"` OpenaiApiBaseUrl string `yaml:"openai_api_base_url"` OpenaiModelName string `yaml:"openai_model_name"` OpenaiPrompt string `yaml:"openai_prompt"` - WebServer struct { + Management struct { + Admin int64 `yaml:"admin"` + ReportGroup int64 `yaml:"report_group"` + ProxyAddr string `yaml:"proxy_addr"` + NapcatWsSrv string `yaml:"napcat_ws_srv"` + NapcatHttpSrv string `yaml:"napcat_http_srv"` + } `yaml:"management"` + WebServer struct { Token string `yaml:"token"` } `yaml:"web_server"` } diff --git a/handler/steamplaying/service.go b/handler/steamplaying/service.go index 5e50200..d3c0f23 100644 --- a/handler/steamplaying/service.go +++ b/handler/steamplaying/service.go @@ -20,7 +20,7 @@ var ProxyAddr = "" func init() { SteamAPIKey = config.ConfigManager.GetConfig().SteamApiKey - ProxyAddr = config.ConfigManager.GetConfig().ProxyAddr + ProxyAddr = config.ConfigManager.GetConfig().Management.ProxyAddr } func init() { diff --git a/main.go b/main.go index d43bf72..02b3bc1 100644 --- a/main.go +++ b/main.go @@ -51,7 +51,7 @@ func main() { go func() { const reconnectDelay = 5 * time.Second for { - client, err := wsclient.NewWebSocketClient("ws", config.ConfigManager.GetConfig().NapcatWsSrv, "") + client, err := wsclient.NewWebSocketClient("ws", config.ConfigManager.GetConfig().Management.NapcatWsSrv, "") if err != nil { log.Printf("WebSocket连接失败: %v, %v 后重试", err, reconnectDelay) time.Sleep(reconnectDelay)