涩图模块:新增引用

This commit is contained in:
Yutousama 2022-04-17 22:05:16 +08:00
parent d5da784033
commit f908066602
2 changed files with 10 additions and 2 deletions

View File

@ -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);
}

View File

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