From f908066602da577c87a0d337d348375f1bb7da24 Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Sun, 17 Apr 2022 22:05:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=A9=E5=9B=BE=E6=A8=A1=E5=9D=97=EF=BC=9A?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/yutou/qqbot/QQBotManager.java | 10 +++++++++- src/main/java/com/yutou/qqbot/models/setu/GetSeTu.java | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/yutou/qqbot/QQBotManager.java b/src/main/java/com/yutou/qqbot/QQBotManager.java index ba82918..bfe2ecf 100644 --- a/src/main/java/com/yutou/qqbot/QQBotManager.java +++ b/src/main/java/com/yutou/qqbot/QQBotManager.java @@ -1,6 +1,7 @@ package com.yutou.qqbot; import com.yutou.qqbot.Listeners.QQMessageListener; +import com.yutou.qqbot.MessageEvent.Message; import com.yutou.qqbot.models.Animal.TurnipProphet; import com.yutou.qqbot.models.Commands.BaiduDown; import com.yutou.qqbot.models.Commands.Bangumi; @@ -18,7 +19,9 @@ import net.mamoe.mirai.Bot; import net.mamoe.mirai.BotFactory; import net.mamoe.mirai.event.GlobalEventChannel; import net.mamoe.mirai.message.data.Image; +import net.mamoe.mirai.message.data.MessageChain; import net.mamoe.mirai.message.data.MessageChainBuilder; +import net.mamoe.mirai.message.data.QuoteReply; import net.mamoe.mirai.utils.BotConfiguration; import net.mamoe.mirai.utils.ExternalResource; @@ -180,12 +183,17 @@ public class QQBotManager { } } } - public String sendMessage(File imageFile,Long qq,String text){ + return sendMessage(imageFile, qq,null, text); + } + public String sendMessage(File imageFile, Long qq, MessageChain replyMessage, String text){ try { if (bot != null) { Image image = getImage(imageFile,qq); MessageChainBuilder builder = new MessageChainBuilder(); + if(replyMessage!=null){ + builder.append(new QuoteReply(replyMessage)); + } if (image != null) { builder.append(image); } diff --git a/src/main/java/com/yutou/qqbot/models/setu/GetSeTu.java b/src/main/java/com/yutou/qqbot/models/setu/GetSeTu.java index abc15d6..88816d4 100644 --- a/src/main/java/com/yutou/qqbot/models/setu/GetSeTu.java +++ b/src/main/java/com/yutou/qqbot/models/setu/GetSeTu.java @@ -91,7 +91,7 @@ public class GetSeTu extends Model { @Override public void onDownload(File file) { super.onDownload(file); - QQBotManager.getInstance().sendMessage(file, qq, builder.toString()); + QQBotManager.getInstance().sendMessage(file, qq,event.getMessage(), builder.toString()); } @Override