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