Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta480 #485

Merged
merged 35 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a6ebe57
beta447
Hoshinonyaruko Jun 29, 2024
1d63fae
beta448
Hoshinonyaruko Jul 1, 2024
cd34627
beta449
Hoshinonyaruko Jul 4, 2024
b790b29
beta450
Hoshinonyaruko Jul 4, 2024
7a9b56a
beta451
Hoshinonyaruko Jul 4, 2024
e17d0d4
beta452
Hoshinonyaruko Jul 4, 2024
1318175
beta453
Hoshinonyaruko Jul 4, 2024
b7f291c
beta454
Hoshinonyaruko Jul 4, 2024
f921895
beta455
Hoshinonyaruko Jul 9, 2024
24108c6
btea455
Hoshinonyaruko Jul 9, 2024
7cdc968
beta456
Hoshinonyaruko Jul 9, 2024
b5d784e
beta457
Hoshinonyaruko Jul 9, 2024
61e4001
beta458
Hoshinonyaruko Jul 9, 2024
6d4116a
beta460
Hoshinonyaruko Jul 9, 2024
2c1f1b7
beta460
Hoshinonyaruko Jul 11, 2024
5c312cd
beta461
Hoshinonyaruko Jul 12, 2024
58304eb
beta462
Hoshinonyaruko Jul 13, 2024
7e7c9f3
beta463
Hoshinonyaruko Jul 15, 2024
188f250
beta464
Hoshinonyaruko Jul 15, 2024
af0296d
beta465
Hoshinonyaruko Jul 18, 2024
500135c
beta467
Hoshinonyaruko Jul 21, 2024
c1a588c
beta468
Hoshinonyaruko Jul 21, 2024
1df8e15
beta469
Hoshinonyaruko Jul 21, 2024
f57ab7b
beta470
Hoshinonyaruko Jul 26, 2024
cd21ad9
beta471
Hoshinonyaruko Aug 1, 2024
6039272
beta472
Hoshinonyaruko Aug 1, 2024
c45b450
beta473
Hoshinonyaruko Aug 1, 2024
f89d6c5
beta473
Hoshinonyaruko Aug 3, 2024
b54fdee
beta475
Hoshinonyaruko Aug 5, 2024
a30a697
beta476
Hoshinonyaruko Aug 8, 2024
ab805cc
beta478
Hoshinonyaruko Aug 8, 2024
6debefd
beta479
Hoshinonyaruko Aug 17, 2024
9cc7e5d
beta479
Hoshinonyaruko Aug 17, 2024
c0fe93c
beta480
Hoshinonyaruko Aug 18, 2024
0fa8679
Merge branch 'main' into beta480
Hoshinonyaruko Aug 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2447,3 +2447,16 @@ func GetLogSuffixPerMins() int {
}
return instance.Settings.LogSuffixPerMins
}

// 获取ThreadsRetMsg的值
func GetThreadsRetMsg() bool {
mu.RLock()
defer mu.RUnlock()

if instance == nil {
fmt.Println("Warning: instance is nil when trying to ThreadsRetMsg value.")
return false
}
return instance.Settings.ThreadsRetMsg
}

28 changes: 23 additions & 5 deletions handlers/send_group_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,12 @@ func HandleSendGroupMsg(client callapi.Client, api openapi.OpenAPI, apiv2 openap
postGroupMessageWithRetry(apiv2, message.Params.GroupID.(string), groupMessage)
}

// 发送成功回执
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
if config.GetThreadsRetMsg() {
go SendResponse(client, err, &message, resp, api, apiv2)
} else {
// 发送成功回执
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
}

delete(foundItems, imageType) // 从foundItems中删除已处理的图片项
messageText = ""
Expand Down Expand Up @@ -432,7 +436,12 @@ func HandleSendGroupMsg(client callapi.Client, api openapi.OpenAPI, apiv2 openap
postGroupMessageWithRetry(apiv2, message.Params.GroupID.(string), groupMessage)
}
//发送成功回执
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
if config.GetThreadsRetMsg() {
go SendResponse(client, err, &message, resp, api, apiv2)
} else {
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
}

}
var resp *dto.GroupMessageResponse
// 遍历foundItems并发送每种信息
Expand Down Expand Up @@ -502,7 +511,11 @@ func HandleSendGroupMsg(client callapi.Client, api openapi.OpenAPI, apiv2 openap
postGroupMessageWithRetry(apiv2, message.Params.GroupID.(string), groupMessage)
}
//发送成功回执
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
if config.GetThreadsRetMsg() {
go SendResponse(client, err, &message, resp, api, apiv2)
} else {
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
}
}
continue // 跳过这个项,继续下一个
}
Expand Down Expand Up @@ -592,7 +605,12 @@ func HandleSendGroupMsg(client callapi.Client, api openapi.OpenAPI, apiv2 openap
}
}
//发送成功回执
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
if config.GetThreadsRetMsg() {
go SendResponse(client, err, &message, resp, api, apiv2)
} else {
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
}

}
}
case "guild":
Expand Down
29 changes: 25 additions & 4 deletions handlers/send_group_msg_raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,11 @@ func HandleSendGroupMsgRaw(client callapi.Client, api openapi.OpenAPI, apiv2 ope
}

// 发送成功回执
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
if config.GetThreadsRetMsg() {
go SendResponse(client, err, &message, resp, api, apiv2)
} else {
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
}

delete(foundItems, imageType) // 从foundItems中删除已处理的图片项
messageText = ""
Expand Down Expand Up @@ -331,7 +335,12 @@ func HandleSendGroupMsgRaw(client callapi.Client, api openapi.OpenAPI, apiv2 ope
echo.PushGlobalStack(pair)
}
//发送成功回执
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
if config.GetThreadsRetMsg() {
go SendResponse(client, err, &message, resp, api, apiv2)
} else {
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
}

}
var resp *dto.GroupMessageResponse
// 遍历foundItems并发送每种信息
Expand Down Expand Up @@ -367,7 +376,13 @@ func HandleSendGroupMsgRaw(client callapi.Client, api openapi.OpenAPI, apiv2 ope
echo.PushGlobalStack(pair)
}
//发送成功回执
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
if config.GetThreadsRetMsg() {
go SendResponse(client, err, &message, resp, api, apiv2)
} else {
//发送成功回执
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
}

}
continue // 跳过这个项,继续下一个
}
Expand Down Expand Up @@ -427,7 +442,13 @@ func HandleSendGroupMsgRaw(client callapi.Client, api openapi.OpenAPI, apiv2 ope
}
}
//发送成功回执
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
if config.GetThreadsRetMsg() {
go SendResponse(client, err, &message, resp, api, apiv2)
} else {
//发送成功回执
retmsg, _ = SendResponse(client, err, &message, resp, api, apiv2)
}

}
}
case "guild":
Expand Down
1 change: 1 addition & 0 deletions structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ type Settings struct {
SaveError bool `yaml:"save_error"`
DowntimeMessage string `yaml:"downtime_message"`
MemoryMsgid bool `yaml:"memory_msgid"`
ThreadsRetMsg bool `yaml:"threads_ret_msg"`
//增长营销类
SelfIntroduce []string `yaml:"self_introduce"`
//api修改
Expand Down
1 change: 1 addition & 0 deletions template/config_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ settings:
save_error : false #将保存保存在log文件夹,方便开发者定位发送错误.
downtime_message : "我正在维护中~请不要担心,维护结束就回来~维护时间:(1小时)"
memory_msgid : false #当你的机器人单日信息量超过100万,就需要高性能SSD或者开启这个选项了.部分依赖msgid的功能可能会受影响(如delete_msg)
threads_ret_msg : false #异步,并发发送回执信息 仅ws可用.

#增长营销类(推荐gensokyo-broadcast项目)
self_introduce : ["",""] #自我介绍,可设置多个随机发送,当不为空时,机器人被邀入群会发送自定义自我介绍 需手动添加新textintent - "GroupAddRobotEventHandler" - "GroupDelRobotEventHandler"
Expand Down
Loading