如何去掉引用回复的 @TA?
-
使用组件:mirai-core
机器人发消息引用回复消息时,总是自带一个@TA,如何去掉这个@TA符号?
如图所示:
java源码
for (QuoteReply quote : quoteList) { MessageSource source = quote.getSource(); MessageChain originalMessage = chainService.selectMessageChain(source); if (originalMessage == null) { // 客户端显示的quote是一个附带 @TA 的引用,即便我使用 new QuoteReply 也是会带 @TA // 关键代码:我把引用 "quote" 传入到了作为了 MessageChain参数 nodeList.add(new ForwardMessage.Node(botId, (int) (System.currentTimeMillis() / 1000), "警告:未存储该消息的原数据", quote)); break; } if (source.getFromId() == sender.getId()) { inputGPTMessageList.add(formatQuote(originalMessage, source, "user")); } else { inputGPTMessageList.add(formatQuote(originalMessage, source, "assistant")); } }
如何取掉这个@TA符号
-
@2446694 我这样没有出现多余的艾特
public static MessageChain quoteReply(MessageEvent event, MessageChain msg) {
return buildMessageChain(getQuoteReply(event), msg);
}
public static MessageChain quoteReply(MessageEvent event, String msg) {
return buildMessageChain(getQuoteReply(event), msg);
} -
public static QuoteReply getQuoteReply(MessageEvent event) { return new QuoteReply(event.getMessage()); }
-
@abc408880155 我使用了new QuoteReply(new PlainText("未存储该元数据"));
但还是会显示@TA,然后我发现,电脑上没有显示@TA,只有手机上显示了@TA,QQ版本是当前最新版 -
@2446694 组件是:mirai-core-2.15.0M1
-
-
@abc408880155 我用的是安卓QQ8.9.50
我裂了,不论我用何种方式声明QuoteReply,都会带一个@TA,强迫症看着很爽 -
@2446694 怪了,我的安卓手机Q版本为8.9.50.10650,但没出现过多余@TA,Bot登陆协议为watch
-
@abc408880155 对了,我用到是聊天记录的形式
subject.sendMessage(new ForwardMessage( preview, String.format("%s的聊天记录", botName), String.format("[回复 @%s]", event.getSenderName()), String.format("回复 @%s", event.getSenderName()), String.format("查看%d条回复消息", nodeList.size()), nodeList ));
-
此回复已被删除! -
@2446694 之前没注意到你回复的是聊天记录,我说的都是单纯的回复群消息
public static void sendGroupMessage(List<Long> groupIDs, Object message) { for (Long groupID : groupIDs) { try { Group group = bot.getGroup(groupID); if (message instanceof MessageChain) { group.sendMessage((MessageChain) message); } else if (message instanceof String) { group.sendMessage((String) message); } else { log.error("Invalid message type: {}", message.getClass().getName()); } } catch (NullPointerException e) { log.error("Failed to send message to group {} - group is null: {}", groupID, e.getMessage()); } catch (IllegalStateException e) { log.error("Failed to send message to group {} - account may be blocked: {}", groupID, e.getMessage()); } catch (Exception e) { log.error("Failed to send message to group {}: {}", groupID, e.getMessage()); } } }