package util

import (
	"log"
	"strconv"

	"git.lxtend.com/lixiangwuxian/qqbot/action"
	"git.lxtend.com/lixiangwuxian/qqbot/qq_message"
)

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}}
}
