diff --git a/handlers/get_group_list.go b/handlers/get_group_list.go index e97d3cb6..84d20343 100644 --- a/handlers/get_group_list.go +++ b/handlers/get_group_list.go @@ -56,8 +56,11 @@ type GroupList struct { func getGroupList(client callapi.Client, api openapi.OpenAPI, apiv2 openapi.OpenAPI, message callapi.ActionMessage) { //群还不支持,这里取得是频道的,如果后期支持了群,那都请求,一起返回 + var groupList GroupList actiontype := "guild" if actiontype == "guild" { + // 初始化 groupList.Data 为一个空数组 + groupList.Data = []Group{} // 检查时间差异 if time.Since(lastCallTime) > 5*time.Minute { // 如果超过5分钟,则重置分页状态 @@ -126,12 +129,12 @@ func getGroupList(client callapi.Client, api openapi.OpenAPI, apiv2 openapi.Open groups = append(groups, channelGroup) } } - groupList := GroupList{ - Data: groups, - Message: "", - RetCode: 0, - Status: "ok", - } + + groupList.Data = groups + groupList.Message = "" + groupList.RetCode = 0 + groupList.Status = "ok" + if message.Echo == "" { groupList.Echo = "0" } else { diff --git a/sys/restart_unix.go b/sys/restart_unix.go index 00ebf1aa..b198f48e 100644 --- a/sys/restart_unix.go +++ b/sys/restart_unix.go @@ -21,7 +21,7 @@ func NewRestarter() *UnixRestarter { func (r *UnixRestarter) Restart(executableName string) error { scriptContent := "#!/bin/sh\n" + "sleep 1\n" + // Sleep for a bit to allow the main application to exit - "." + executableName + "\n" + "exec " + executableName + "\n" scriptName := "restart.sh" if err := os.WriteFile(scriptName, []byte(scriptContent), 0755); err != nil {