qq_bot/util/message.go
2025-07-05 15:46:36 +08:00

23 lines
737 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package util
import (
"log"
"strconv"
"git.lxtend.com/lixiangwuxian/qqbot/action"
"git.lxtend.com/lixiangwuxian/qqbot/qq_message"
)
// NewSelfNodeMessage 创建一个合并转发消息内的消息列表内容为content发送者为当前登录的账号
func NewSelfNodeMessage(content ...any) *qq_message.NodeMessage {
loginAccountInfo, err := action.GetLoginAccountInfo()
if err != nil {
log.Println("GetLoginAccountInfo error:", err)
return nil
}
if loginAccountInfo == nil {
return nil
}
return &qq_message.NodeMessage{Type: qq_message.TypeNode, Data: qq_message.NodeMessageData{UserID: strconv.FormatInt(int64(loginAccountInfo.Data.UserID), 10), Nickname: loginAccountInfo.Data.Nickname, Content: content}}
}