refactor: 修改 NewSelfNodeMessage 函数以接受内容参数,并更新消息处理逻辑以简化代码结构
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
"git.lxtend.com/qqbot/message"
|
||||
)
|
||||
|
||||
func NewSelfNodeMessage() *message.NodeMessage {
|
||||
func NewSelfNodeMessage(content ...any) *message.NodeMessage {
|
||||
loginAccountInfo, err := action.GetLoginAccountInfo()
|
||||
if err != nil {
|
||||
log.Println("GetLoginAccountInfo error:", err)
|
||||
@@ -17,5 +17,5 @@ func NewSelfNodeMessage() *message.NodeMessage {
|
||||
if loginAccountInfo == nil {
|
||||
return nil
|
||||
}
|
||||
return &message.NodeMessage{Type: message.TypeNode, Data: message.NodeMessageData{UserID: strconv.FormatInt(int64(loginAccountInfo.Data.UserID), 10), Nickname: loginAccountInfo.Data.Nickname}}
|
||||
return &message.NodeMessage{Type: message.TypeNode, Data: message.NodeMessageData{UserID: strconv.FormatInt(int64(loginAccountInfo.Data.UserID), 10), Nickname: loginAccountInfo.Data.Nickname, Content: content}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user