From 84b4889def8ab891ef963a3cdf10108b8318918a Mon Sep 17 00:00:00 2001 From: Mrs4s <1844812067@qq.com> Date: Sun, 25 Oct 2020 22:06:03 +0800 Subject: [PATCH] fix issue of sending the empty message. --- coolq/bot.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coolq/bot.go b/coolq/bot.go index 0483d57..b71163d 100644 --- a/coolq/bot.go +++ b/coolq/bot.go @@ -211,6 +211,10 @@ func (bot *CQBot) SendGroupMessage(groupId int64, m *message.SendingMessage) int } newElem = append(newElem, elem) } + if len(newElem) == 0 { + log.Warnf("群消息发送失败: 消息为空.") + return -1 + } m.Elements = newElem ret := bot.Client.SendGroupMessage(groupId, m, ForceFragmented) if ret == nil || ret.Id == -1 {