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

Beta491 #495

Merged
merged 47 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 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
91cf223
beta481
Hoshinonyaruko Aug 18, 2024
a3aa6c1
beta482
Hoshinonyaruko Aug 18, 2024
0917e56
beta483
Hoshinonyaruko Aug 19, 2024
dd1f774
beta484
Hoshinonyaruko Aug 19, 2024
1c87d61
beta485
Hoshinonyaruko Aug 20, 2024
aac474a
beta486
Hoshinonyaruko Aug 20, 2024
2604eb7
beta486
Hoshinonyaruko Aug 20, 2024
76377be
beta487
Hoshinonyaruko Aug 20, 2024
cb095ec
beta487
Hoshinonyaruko Aug 20, 2024
34c92ae
beta489
Hoshinonyaruko Aug 21, 2024
288cf7a
beta490
Hoshinonyaruko Aug 22, 2024
d3a6eb8
beta491
Hoshinonyaruko Aug 22, 2024
8904606
Merge branch 'main' into beta491
Hoshinonyaruko Aug 22, 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
4 changes: 2 additions & 2 deletions echo/messageidmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func GetLazyMessagesId(groupID string) string {
store.mu.RLock()
defer store.mu.RUnlock()

fiveMinutesAgo := time.Now().Add(-5 * time.Minute)
fiveMinutesAgo := time.Now().Add(-4 * time.Minute)
var recentMessages []string
for _, record := range store.records[groupID] {
if record.timestamp.After(fiveMinutesAgo) {
Expand Down Expand Up @@ -94,7 +94,7 @@ func GetLazyMessagesIdv2(groupID, userID string) string { //1
// 构建复合键
key := groupID + "." + userID

fiveMinutesAgo := time.Now().Add(-5 * time.Minute)
fiveMinutesAgo := time.Now().Add(-4 * time.Minute)
var recentMessages []string
for _, record := range store.records[key] {
if record.timestamp.After(fiveMinutesAgo) {
Expand Down
70 changes: 38 additions & 32 deletions handlers/send_group_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,24 @@ func HandleSendGroupMsg(client callapi.Client, api openapi.OpenAPI, apiv2 openap
}

if message.Params.GroupID != nil && len(message.Params.GroupID.(string)) != 32 {
//设置递归 对直接向gsk发送action时有效果
if msgType == "" {
messageCopy := message
if err != nil {
mylog.Printf("错误:无法转换 ID %v\n", err)
} else {
// 递归3次
echo.AddMapping(idInt64, 4)
// 递归调用handleSendGroupMsg,使用设置的消息类型
echo.AddMsgType(config.GetAppIDStr(), idInt64, "group_private")
retmsg, _ = HandleSendGroupMsg(client, api, apiv2, messageCopy)
// stringob11通过字段判断类型,不需要递归
if !config.GetStringOb11() {
//设置递归 对直接向gsk发送action时有效果
if msgType == "" {
messageCopy := message
if err != nil {
mylog.Printf("错误:无法转换 ID %v\n", err)
} else {
// 递归3次
echo.AddMapping(idInt64, 4)
// 递归调用handleSendGroupMsg,使用设置的消息类型
echo.AddMsgType(config.GetAppIDStr(), idInt64, "group_private")
retmsg, _ = HandleSendGroupMsg(client, api, apiv2, messageCopy)
}
} else if echo.GetMapping(idInt64) <= 0 {
// 特殊值代表不递归
echo.AddMapping(idInt64, 10)
}
} else if echo.GetMapping(idInt64) <= 0 {
// 特殊值代表不递归
echo.AddMapping(idInt64, 10)
}
}

Expand Down Expand Up @@ -697,24 +700,27 @@ func HandleSendGroupMsg(client callapi.Client, api openapi.OpenAPI, apiv2 openap
mylog.Printf("Unknown message type: %s", msgType)
}

// 如果递归id不是10(不递归特殊值)
if echo.GetMapping(idInt64) != 10 {
//重置递归类型 递归结束重置类型,避免下一次同样id,不同类型的请求被使用上一次类型
if echo.GetMapping(idInt64) <= 0 {
echo.AddMsgType(config.GetAppIDStr(), idInt64, "")
}

//减少递归计数器
echo.AddMapping(idInt64, echo.GetMapping(idInt64)-1)

//递归3次枚举类型
if echo.GetMapping(idInt64) > 0 {
tryMessageTypes := []string{"group", "guild", "guild_private"}
messageCopy := message // 创建message的副本
echo.AddMsgType(config.GetAppIDStr(), idInt64, tryMessageTypes[echo.GetMapping(idInt64)-1])
delay := config.GetSendDelay()
time.Sleep(time.Duration(delay) * time.Millisecond)
retmsg, _ = HandleSendGroupMsg(client, api, apiv2, messageCopy)
// stringob11不需要递归
if !config.GetStringOb11() {
// 如果递归id不是10(不递归特殊值)
if echo.GetMapping(idInt64) != 10 {
//重置递归类型 递归结束重置类型,避免下一次同样id,不同类型的请求被使用上一次类型
if echo.GetMapping(idInt64) <= 0 {
echo.AddMsgType(config.GetAppIDStr(), idInt64, "")
}

//减少递归计数器
echo.AddMapping(idInt64, echo.GetMapping(idInt64)-1)

//递归3次枚举类型
if echo.GetMapping(idInt64) > 0 {
tryMessageTypes := []string{"group", "guild", "guild_private"}
messageCopy := message // 创建message的副本
echo.AddMsgType(config.GetAppIDStr(), idInt64, tryMessageTypes[echo.GetMapping(idInt64)-1])
delay := config.GetSendDelay()
time.Sleep(time.Duration(delay) * time.Millisecond)
retmsg, _ = HandleSendGroupMsg(client, api, apiv2, messageCopy)
}
}
}

Expand Down
6 changes: 0 additions & 6 deletions mylog/errlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import (

// 独立的错误日志记录函数
func ErrLogToFile(level, message string) {
if !enableFileLogGlobal {
return
}
filename := time.Now().Format("2006-01-02") + "-error.log"
filepath := logPath + "/" + filename

Expand All @@ -31,9 +28,6 @@ func ErrLogToFile(level, message string) {

// 独立的错误日志记录函数
func ErrInterfaceToFile(level, message interface{}) {
if !enableFileLogGlobal {
return
}
filename := time.Now().Format("2006-01-02") + "-error.log"
filepath := logPath + "/" + filename

Expand Down
Loading