feat: 添加 SendForward 函数以支持消息转发,并更新 GenSendPkg 函数以处理转发逻辑
This commit is contained in:
@@ -14,32 +14,52 @@ type SendPkg struct {
|
||||
|
||||
// 上游包的参数结构体
|
||||
type UpstreamParams struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
GroupID int64 `json:"group_id"`
|
||||
Message interface{} `json:"message"`
|
||||
AutoEscape bool `json:"auto_escape"`
|
||||
UserID int64 `json:"user_id"`
|
||||
GroupID int64 `json:"group_id"`
|
||||
Message any `json:"message"`
|
||||
AutoEscape bool `json:"auto_escape"`
|
||||
}
|
||||
|
||||
func GenSendPkg(userID int64, groupID int64, message interface{}, autoEscape bool) SendPkg {
|
||||
func GenSendPkg(userID int64, groupID int64, message any, autoEscape bool, forward bool) SendPkg {
|
||||
if groupID == 0 {
|
||||
if forward {
|
||||
return SendPkg{
|
||||
Action: constants.FORWARD_MSG_SEND,
|
||||
Params: UpstreamParams{
|
||||
UserID: userID,
|
||||
Message: message,
|
||||
},
|
||||
}
|
||||
} else {
|
||||
return SendPkg{
|
||||
Action: constants.PRIVATE_MSG_SEND,
|
||||
Params: UpstreamParams{
|
||||
UserID: userID,
|
||||
Message: message,
|
||||
AutoEscape: autoEscape,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
if forward {
|
||||
return SendPkg{
|
||||
Action: constants.PRIVATE_MSG_SEND,
|
||||
Action: constants.FORWARD_MSG_SEND,
|
||||
Params: UpstreamParams{
|
||||
UserID: userID,
|
||||
Message: message,
|
||||
},
|
||||
}
|
||||
} else {
|
||||
return SendPkg{
|
||||
Action: constants.GROUP_MSG_SEND,
|
||||
Params: UpstreamParams{
|
||||
UserID: userID,
|
||||
GroupID: groupID,
|
||||
Message: message,
|
||||
AutoEscape: autoEscape,
|
||||
},
|
||||
}
|
||||
}
|
||||
return SendPkg{
|
||||
Action: constants.GROUP_MSG_SEND,
|
||||
Params: UpstreamParams{
|
||||
UserID: userID,
|
||||
GroupID: groupID,
|
||||
Message: message,
|
||||
AutoEscape: autoEscape,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// 事件的消息结构体
|
||||
|
||||
Reference in New Issue
Block a user