Appearance
消息构建
Bngeuit 静态方法覆盖了绝大多数常用消息发送场景:文本、Markdown、富媒体、卡片,群聊与私聊一一对应。
msgSeq 参数
sendXXXX 方法(主动发送)不需要传 msgSeq。只有 replyXXXX(被动回复)和 quoteXXXX(引用回复)需要传 msgSeq(消息序号),用于去重/排序。
Bngeuit 静态方法
群聊文本
java
Bngeuit.sendGroupText(groupOpenid, "你好"); // 主动发送
Bngeuit.sendGroupText(groupOpenid, "你好", keyboard); // 带键盘
Bngeuit.replyGroupText(groupOpenid, msgId, msgSeq, "回复"); // 被动回复
Bngeuit.quoteGroupText(groupOpenid, refIdx, msgId, msgSeq, "引用回复"); // 引用回复群聊 Markdown
java
Bngeuit.sendGroupMarkdown(groupOpenid, "**加粗**"); // 发送
Bngeuit.sendGroupMarkdown(groupOpenid, "**加粗**", keyboard); // 带键盘
Bngeuit.replyGroupMarkdown(groupOpenid, msgId, msgSeq, "**回复**");
Bngeuit.quoteGroupMarkdown(groupOpenid, refIdx, msgId, msgSeq, "**引用**");群聊富媒体(ByUrl 公网 URL / ByFile 本地文件)
java
Bngeuit.sendGroupImageByUrl(groupOpenid, "https://.../img.png");
Bngeuit.sendGroupImageByFile(groupOpenid, new File("img.png")); // 本地自动分片上传
Bngeuit.sendGroupVideoByUrl(groupOpenid, url);
Bngeuit.sendGroupVideoByFile(groupOpenid, new File("video.mp4"));
Bngeuit.sendGroupVoiceByUrl(groupOpenid, url);
Bngeuit.sendGroupVoiceByFile(groupOpenid, new File("voice.silk"));
Bngeuit.sendGroupFileByUrl(groupOpenid, url);
Bngeuit.sendGroupFileByFile(groupOpenid, new File("file.rar"));群聊卡片
java
Bngeuit.sendGroupCard(groupOpenid, "标题", "描述", "https://img.png", "https://link");
// 跳转 URL 需要 QQ 白名单域名,传 null 可展示不可点击私聊文本
java
Bngeuit.sendC2CText(openid, "你好"); // 主动发送
Bngeuit.sendC2CText(openid, "你好", keyboard); // 带键盘
Bngeuit.replyC2CText(openid, msgId, msgSeq, "回复");
Bngeuit.quoteC2CText(openid, refIdx, msgId, msgSeq, "引用回复");私聊 Markdown
java
Bngeuit.sendC2CMarkdown(openid, "**加粗**");
Bngeuit.sendC2CMarkdown(openid, "**加粗**", keyboard);
Bngeuit.replyC2CMarkdown(openid, msgId, msgSeq, "**回复**");
Bngeuit.quoteC2CMarkdown(openid, refIdx, msgId, msgSeq, "**引用**");私聊富媒体
java
Bngeuit.sendC2CImageByUrl(openid, "https://.../img.png");
Bngeuit.sendC2CImageByFile(openid, new File("img.png"));
Bngeuit.sendC2CVideoByUrl(openid, url);
Bngeuit.sendC2CVideoByFile(openid, new File("video.mp4"));
Bngeuit.sendC2CVoiceByUrl(openid, url);
Bngeuit.sendC2CVoiceByFile(openid, new File("voice.silk"));
Bngeuit.sendC2CFileByUrl(openid, url);
Bngeuit.sendC2CFileByFile(openid, new File("file.rar"));Markdown 图片素材
Markdown 消息里的图片可以让平台托管(qqbot-media:// 引用),避免依赖公网图床:
java
Bngeuit.uploadMediaImage(new File("kline.png")); // 返回 qqbot-media:// 引用链接详见 素材管理。
其他
java
Bngeuit.sendC2CTyping(openid, 5); // "正在输入..."
Bngeuit.deleteGroupMessage(groupOpenid, messageId); // 撤回群消息
Bngeuit.deleteC2CMessage(openid, messageId); // 撤回私聊消息
Bngeuit.respondInteraction(interactionId, InteractionResponseCode.SUCCESS); // 互动响应