From af232c2ecfce90fd2ba6895868a9a61b8de8fb38 Mon Sep 17 00:00:00 2001 From: lixiangwuxian Date: Tue, 15 Oct 2024 23:05:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action/cq_msg_gen.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 action/cq_msg_gen.go diff --git a/action/cq_msg_gen.go b/action/cq_msg_gen.go new file mode 100644 index 0000000..780009a --- /dev/null +++ b/action/cq_msg_gen.go @@ -0,0 +1,24 @@ +package action + +import "fmt" + +func GenReply(msgId int32, text string, qq int64, time int64, seq int64) string { + if msgId == 0 { + return "" + } + cq_str := "[CQ:reply,id=" + fmt.Sprint(msgId) + if text != "" { + cq_str += ",text=" + text + } + if qq != 0 { + cq_str += ",qq=" + fmt.Sprint(qq) + } + if time != 0 { + cq_str += ",time=" + fmt.Sprint(time) + } + if seq != 0 { + cq_str += ",seq=" + fmt.Sprint(seq) + } + cq_str += "]" + return cq_str +}