From a291d98c24f797dff44b41565bda4797cc5a97ba Mon Sep 17 00:00:00 2001 From: SanaeFox <36219542+Hoshinonyaruko@users.noreply.github.com> Date: Mon, 8 Jan 2024 13:47:44 +0800 Subject: [PATCH 1/3] beta122 (#291) --- readme.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readme.md b/readme.md index d8f7a8ee..90341e90 100644 --- a/readme.md +++ b/readme.md @@ -40,6 +40,9 @@ _✨ 基于 [OneBot](https://github.com/howmanybots/onebot/blob/master/README.md · 参与贡献
+ ## 引用 - [`tencent-connect/botgo`](https://github.com/tencent-connect/botgo): 本项目引用了此项目,并做了一点改动. From b7a2dd49701359e653be1418d80bfe6af0f08c4b Mon Sep 17 00:00:00 2001 From: SanaeFox <36219542+Hoshinonyaruko@users.noreply.github.com> Date: Thu, 11 Jan 2024 17:14:52 +0800 Subject: [PATCH 2/3] Beta123 (#294) * beta122 * beta123 --- handlers/send_msg.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/handlers/send_msg.go b/handlers/send_msg.go index 1982ae06..b06dc2b5 100644 --- a/handlers/send_msg.go +++ b/handlers/send_msg.go @@ -33,13 +33,15 @@ func HandleSendMsg(client callapi.Client, api openapi.OpenAPI, apiv2 openapi.Ope if msgType == "" { msgType = GetMessageTypeByUserid(config.GetAppIDStr(), message.Params.UserID) } - //新增 内存获取不到从数据库获取 + //顺序有讲究 if msgType == "" { - msgType = GetMessageTypeByUseridV2(message.Params.UserID) + msgType = GetMessageTypeByGroupidV2(message.Params.GroupID) } + //新增 内存获取不到从数据库获取 if msgType == "" { - msgType = GetMessageTypeByGroupidV2(message.Params.GroupID) + msgType = GetMessageTypeByUseridV2(message.Params.UserID) } + var idInt64 int64 var err error From 72e841f4f64d24eb802087b9251274418b7a53ff Mon Sep 17 00:00:00 2001 From: SanaeFox <36219542+Hoshinonyaruko@users.noreply.github.com> Date: Thu, 11 Jan 2024 19:44:27 +0800 Subject: [PATCH 3/3] Beta124 (#295) * beta122 * beta123 * beta124 * beta124 --- handlers/send_msg.go | 11 +++++++---- handlers/send_private_msg.go | 12 ++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/handlers/send_msg.go b/handlers/send_msg.go index b06dc2b5..04870d4c 100644 --- a/handlers/send_msg.go +++ b/handlers/send_msg.go @@ -41,14 +41,16 @@ func HandleSendMsg(client callapi.Client, api openapi.OpenAPI, apiv2 openapi.Ope if msgType == "" { msgType = GetMessageTypeByUseridV2(message.Params.UserID) } - - var idInt64 int64 + + var idInt64, idInt642 int64 var err error if message.Params.GroupID != "" { - idInt64, err = ConvertToInt64(message.Params.GroupID) + idInt64, _ = ConvertToInt64(message.Params.GroupID) + idInt642, _ = ConvertToInt64(message.Params.UserID) } else if message.Params.UserID != "" { - idInt64, err = ConvertToInt64(message.Params.UserID) + idInt64, _ = ConvertToInt64(message.Params.UserID) + idInt642, _ = ConvertToInt64(message.Params.GroupID) } //设置递归 对直接向gsk发送action时有效果 @@ -101,6 +103,7 @@ func HandleSendMsg(client callapi.Client, api openapi.OpenAPI, apiv2 openapi.Ope //重置递归类型 if echo.GetMapping(idInt64) <= 0 { echo.AddMsgType(config.GetAppIDStr(), idInt64, "") + echo.AddMsgType(config.GetAppIDStr(), idInt642, "") } echo.AddMapping(idInt64, echo.GetMapping(idInt64)-1) diff --git a/handlers/send_private_msg.go b/handlers/send_private_msg.go index 43bcba67..6dcefe7d 100644 --- a/handlers/send_private_msg.go +++ b/handlers/send_private_msg.go @@ -29,14 +29,14 @@ func HandleSendPrivateMsg(client callapi.Client, api openapi.OpenAPI, apiv2 open msgType = echo.GetMsgTypeByKey(echoStr) } - //如果获取不到 就用group_id获取信息类型 - if msgType == "" { - msgType = GetMessageTypeByGroupid(config.GetAppIDStr(), message.Params.GroupID) - } //如果获取不到 就用user_id获取信息类型 if msgType == "" { msgType = GetMessageTypeByUserid(config.GetAppIDStr(), message.Params.UserID) } + //顺序,私聊优先从UserID推断类型会更准确 + if msgType == "" { + msgType = GetMessageTypeByGroupid(config.GetAppIDStr(), message.Params.GroupID) + } //新增 内存获取不到从数据库获取 if msgType == "" { msgType = GetMessageTypeByUseridV2(message.Params.UserID) @@ -68,7 +68,7 @@ func HandleSendPrivateMsg(client callapi.Client, api openapi.OpenAPI, apiv2 open } switch msgType { - case "group_private","group": + case "group_private", "group": //私聊信息 var UserID string if config.GetIdmapPro() { @@ -266,7 +266,7 @@ func HandleSendPrivateMsg(client callapi.Client, api openapi.OpenAPI, apiv2 open retmsg, _ = SendResponse(client, err, &message) } } - case "guild_private","guild": + case "guild_private", "guild": //当收到发私信调用 并且来源是频道 retmsg, _ = HandleSendGuildChannelPrivateMsg(client, api, apiv2, message, nil, nil) default: