mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix: quick reply friend msg
This commit is contained in:
parent
51602b987e
commit
b5e578733f
@ -1,16 +1,16 @@
|
|||||||
import {
|
import {
|
||||||
AtType,
|
AtType,
|
||||||
ElementType,
|
ElementType,
|
||||||
FaceType,
|
FaceType,
|
||||||
PicType,
|
PicType,
|
||||||
SendArkElement,
|
SendArkElement,
|
||||||
SendFaceElement,
|
SendFaceElement,
|
||||||
SendFileElement,
|
SendFileElement,
|
||||||
SendPicElement,
|
SendPicElement,
|
||||||
SendPttElement,
|
SendPttElement,
|
||||||
SendReplyElement,
|
SendReplyElement,
|
||||||
SendTextElement,
|
SendTextElement,
|
||||||
SendVideoElement
|
SendVideoElement
|
||||||
} from "./types";
|
} from "./types";
|
||||||
import {promises as fs} from "node:fs";
|
import {promises as fs} from "node:fs";
|
||||||
import ffmpeg from "fluent-ffmpeg"
|
import ffmpeg from "fluent-ffmpeg"
|
||||||
@ -24,280 +24,295 @@ import {isNull} from "../common/utils";
|
|||||||
|
|
||||||
export class SendMsgElementConstructor {
|
export class SendMsgElementConstructor {
|
||||||
|
|
||||||
static poke(groupCode: string, uin: string){
|
static poke(groupCode: string, uin: string) {
|
||||||
return null
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
static text(content: string): SendTextElement {
|
||||||
|
return {
|
||||||
|
elementType: ElementType.TEXT,
|
||||||
|
elementId: "",
|
||||||
|
textElement: {
|
||||||
|
content,
|
||||||
|
atType: AtType.notAt,
|
||||||
|
atUid: "",
|
||||||
|
atTinyId: "",
|
||||||
|
atNtUid: "",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static at(atUid: string, atNtUid: string, atType: AtType, atName: string): SendTextElement {
|
||||||
|
return {
|
||||||
|
elementType: ElementType.TEXT,
|
||||||
|
elementId: "",
|
||||||
|
textElement: {
|
||||||
|
content: `@${atName}`,
|
||||||
|
atType,
|
||||||
|
atUid,
|
||||||
|
atTinyId: "",
|
||||||
|
atNtUid,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static reply(msgSeq: string, msgId: string, senderUin: string, senderUinStr: string): SendReplyElement {
|
||||||
|
return {
|
||||||
|
elementType: ElementType.REPLY,
|
||||||
|
elementId: "",
|
||||||
|
replyElement: {
|
||||||
|
replayMsgSeq: msgSeq, // raw.msgSeq
|
||||||
|
replayMsgId: msgId, // raw.msgId
|
||||||
|
senderUin: senderUin,
|
||||||
|
senderUinStr: senderUinStr,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
static text(content: string): SendTextElement {
|
}
|
||||||
return {
|
|
||||||
elementType: ElementType.TEXT,
|
static async pic(picPath: string, summary: string = "", subType: 0 | 1 = 0): Promise<SendPicElement> {
|
||||||
elementId: "",
|
const {md5, fileName, path, fileSize} = await NTQQFileApi.uploadFile(picPath, ElementType.PIC, subType);
|
||||||
textElement: {
|
if (fileSize === 0) {
|
||||||
content,
|
throw "文件异常,大小为0";
|
||||||
atType: AtType.notAt,
|
}
|
||||||
atUid: "",
|
const imageSize = await NTQQFileApi.getImageSize(picPath);
|
||||||
atTinyId: "",
|
const picElement = {
|
||||||
atNtUid: "",
|
md5HexStr: md5,
|
||||||
},
|
fileSize: fileSize.toString(),
|
||||||
};
|
picWidth: imageSize.width,
|
||||||
|
picHeight: imageSize.height,
|
||||||
|
fileName: fileName,
|
||||||
|
sourcePath: path,
|
||||||
|
original: true,
|
||||||
|
picType: isGIF(picPath) ? PicType.gif : PicType.jpg,
|
||||||
|
picSubType: subType,
|
||||||
|
fileUuid: "",
|
||||||
|
fileSubId: "",
|
||||||
|
thumbFileSize: 0,
|
||||||
|
summary
|
||||||
|
};
|
||||||
|
log("图片信息", picElement)
|
||||||
|
return {
|
||||||
|
elementType: ElementType.PIC,
|
||||||
|
elementId: "",
|
||||||
|
picElement,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static async file(filePath: string, fileName: string = ""): Promise<SendFileElement> {
|
||||||
|
const {md5, fileName: _fileName, path, fileSize} = await NTQQFileApi.uploadFile(filePath, ElementType.FILE);
|
||||||
|
if (fileSize === 0) {
|
||||||
|
throw "文件异常,大小为0";
|
||||||
|
}
|
||||||
|
let element: SendFileElement = {
|
||||||
|
elementType: ElementType.FILE,
|
||||||
|
elementId: "",
|
||||||
|
fileElement: {
|
||||||
|
fileName: fileName || _fileName,
|
||||||
|
"filePath": path,
|
||||||
|
"fileSize": (fileSize).toString(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static at(atUid: string, atNtUid: string, atType: AtType, atName: string): SendTextElement {
|
return element;
|
||||||
return {
|
}
|
||||||
elementType: ElementType.TEXT,
|
|
||||||
elementId: "",
|
static async video(filePath: string, fileName: string = "", diyThumbPath: string = ""): Promise<SendVideoElement> {
|
||||||
textElement: {
|
let {fileName: _fileName, path, fileSize, md5} = await NTQQFileApi.uploadFile(filePath, ElementType.VIDEO);
|
||||||
content: `@${atName}`,
|
if (fileSize === 0) {
|
||||||
atType,
|
throw "文件异常,大小为0";
|
||||||
atUid,
|
|
||||||
atTinyId: "",
|
|
||||||
atNtUid,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
const pathLib = require("path");
|
||||||
static reply(msgSeq: string, msgId: string, senderUin: string, senderUinStr: string): SendReplyElement {
|
let thumbDir = path.replace(`${pathLib.sep}Ori${pathLib.sep}`, `${pathLib.sep}Thumb${pathLib.sep}`)
|
||||||
return {
|
thumbDir = pathLib.dirname(thumbDir)
|
||||||
elementType: ElementType.REPLY,
|
// log("thumb 目录", thumb)
|
||||||
elementId: "",
|
let videoInfo = {
|
||||||
replyElement: {
|
width: 1920, height: 1080,
|
||||||
replayMsgSeq: msgSeq, // raw.msgSeq
|
time: 15,
|
||||||
replayMsgId: msgId, // raw.msgId
|
format: "mp4",
|
||||||
senderUin: senderUin,
|
size: fileSize,
|
||||||
senderUinStr: senderUinStr,
|
filePath
|
||||||
}
|
};
|
||||||
}
|
try {
|
||||||
|
videoInfo = await getVideoInfo(path);
|
||||||
|
log("视频信息", videoInfo)
|
||||||
|
} catch (e) {
|
||||||
|
log("获取视频信息失败", e)
|
||||||
}
|
}
|
||||||
|
const createThumb = new Promise<string>((resolve, reject) => {
|
||||||
|
const thumbFileName = `${md5}_0.png`
|
||||||
|
const thumbPath = pathLib.join(thumbDir, thumbFileName)
|
||||||
|
log("开始生成视频缩略图", filePath);
|
||||||
|
let completed = false;
|
||||||
|
|
||||||
static async pic(picPath: string, summary: string = "", subType: 0|1=0): Promise<SendPicElement> {
|
function useDefaultThumb() {
|
||||||
const {md5, fileName, path, fileSize} = await NTQQFileApi.uploadFile(picPath, ElementType.PIC, subType);
|
if (completed) return;
|
||||||
if (fileSize === 0) {
|
log("获取视频封面失败,使用默认封面");
|
||||||
throw "文件异常,大小为0";
|
fs.writeFile(thumbPath, defaultVideoThumb).then(() => {
|
||||||
}
|
resolve(thumbPath);
|
||||||
const imageSize = await NTQQFileApi.getImageSize(picPath);
|
}).catch(reject)
|
||||||
const picElement = {
|
}
|
||||||
md5HexStr: md5,
|
|
||||||
fileSize: fileSize.toString(),
|
|
||||||
picWidth: imageSize.width,
|
|
||||||
picHeight: imageSize.height,
|
|
||||||
fileName: fileName,
|
|
||||||
sourcePath: path,
|
|
||||||
original: true,
|
|
||||||
picType: isGIF(picPath) ? PicType.gif : PicType.jpg,
|
|
||||||
picSubType: subType,
|
|
||||||
fileUuid: "",
|
|
||||||
fileSubId: "",
|
|
||||||
thumbFileSize: 0,
|
|
||||||
summary
|
|
||||||
};
|
|
||||||
log("图片信息", picElement)
|
|
||||||
return {
|
|
||||||
elementType: ElementType.PIC,
|
|
||||||
elementId: "",
|
|
||||||
picElement,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static async file(filePath: string, fileName: string = ""): Promise<SendFileElement> {
|
setTimeout(useDefaultThumb, 5000);
|
||||||
const {md5, fileName: _fileName, path, fileSize} = await NTQQFileApi.uploadFile(filePath, ElementType.FILE);
|
ffmpeg(filePath)
|
||||||
if (fileSize === 0) {
|
.on("end", () => {
|
||||||
throw "文件异常,大小为0";
|
|
||||||
}
|
|
||||||
let element: SendFileElement = {
|
|
||||||
elementType: ElementType.FILE,
|
|
||||||
elementId: "",
|
|
||||||
fileElement: {
|
|
||||||
fileName: fileName || _fileName,
|
|
||||||
"filePath": path,
|
|
||||||
"fileSize": (fileSize).toString(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
static async video(filePath: string, fileName: string = "", diyThumbPath: string = ""): Promise<SendVideoElement> {
|
|
||||||
let {fileName: _fileName, path, fileSize, md5} = await NTQQFileApi.uploadFile(filePath, ElementType.VIDEO);
|
|
||||||
if (fileSize === 0) {
|
|
||||||
throw "文件异常,大小为0";
|
|
||||||
}
|
|
||||||
const pathLib = require("path");
|
|
||||||
let thumb = path.replace(`${pathLib.sep}Ori${pathLib.sep}`, `${pathLib.sep}Thumb${pathLib.sep}`)
|
|
||||||
thumb = pathLib.dirname(thumb)
|
|
||||||
// log("thumb 目录", thumb)
|
|
||||||
let videoInfo = {
|
|
||||||
width: 1920, height: 1080,
|
|
||||||
time: 15,
|
|
||||||
format: "mp4",
|
|
||||||
size: fileSize,
|
|
||||||
filePath
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
videoInfo = await getVideoInfo(path);
|
|
||||||
log("视频信息", videoInfo)
|
|
||||||
} catch (e) {
|
|
||||||
log("获取视频信息失败", e)
|
|
||||||
}
|
|
||||||
const createThumb = new Promise<string>((resolve, reject) => {
|
|
||||||
const thumbFileName = `${md5}_0.png`
|
|
||||||
const thumbPath = pathLib.join(thumb, thumbFileName)
|
|
||||||
ffmpeg(filePath)
|
|
||||||
.on("end", () => {
|
|
||||||
})
|
|
||||||
.on("error", (err) => {
|
|
||||||
log("获取视频封面失败,使用默认封面", err)
|
|
||||||
if (diyThumbPath) {
|
|
||||||
fs.copyFile(diyThumbPath, thumbPath).then(() => {
|
|
||||||
resolve(thumbPath);
|
|
||||||
}).catch(reject)
|
|
||||||
} else {
|
|
||||||
fs.writeFile(thumbPath, defaultVideoThumb).then(() => {
|
|
||||||
resolve(thumbPath);
|
|
||||||
}).catch(reject)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.screenshots({
|
|
||||||
timestamps: [0],
|
|
||||||
filename: thumbFileName,
|
|
||||||
folder: thumb,
|
|
||||||
size: videoInfo.width + "x" + videoInfo.height
|
|
||||||
}).on("end", () => {
|
|
||||||
resolve(thumbPath);
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
let thumbPath = new Map()
|
.on("error", (err) => {
|
||||||
const _thumbPath = await createThumb;
|
if (diyThumbPath) {
|
||||||
const thumbSize = (await fs.stat(_thumbPath)).size;
|
fs.copyFile(diyThumbPath, thumbPath).then(() => {
|
||||||
// log("生成缩略图", _thumbPath)
|
completed = true;
|
||||||
thumbPath.set(0, _thumbPath)
|
resolve(thumbPath);
|
||||||
const thumbMd5 = await calculateFileMD5(_thumbPath);
|
}).catch(reject)
|
||||||
let element: SendVideoElement = {
|
} else {
|
||||||
elementType: ElementType.VIDEO,
|
useDefaultThumb()
|
||||||
elementId: "",
|
}
|
||||||
videoElement: {
|
})
|
||||||
fileName: fileName || _fileName,
|
.screenshots({
|
||||||
filePath: path,
|
timestamps: [0],
|
||||||
videoMd5: md5,
|
filename: thumbFileName,
|
||||||
thumbMd5,
|
folder: thumbDir,
|
||||||
fileTime: videoInfo.time,
|
size: videoInfo.width + "x" + videoInfo.height
|
||||||
thumbPath: thumbPath,
|
}).on("end", () => {
|
||||||
thumbSize,
|
log("生成视频缩略图", thumbPath)
|
||||||
thumbWidth: videoInfo.width,
|
completed = true;
|
||||||
thumbHeight: videoInfo.height,
|
resolve(thumbPath);
|
||||||
fileSize: "" + fileSize,
|
})
|
||||||
// fileUuid: "",
|
})
|
||||||
// transferStatus: 0,
|
let thumbPath = new Map()
|
||||||
// progress: 0,
|
const _thumbPath = await createThumb;
|
||||||
// invalidState: 0,
|
log("生成缩略图", _thumbPath)
|
||||||
// fileSubId: "",
|
const thumbSize = (await fs.stat(_thumbPath)).size;
|
||||||
// fileBizId: null,
|
// log("生成缩略图", _thumbPath)
|
||||||
// originVideoMd5: "",
|
thumbPath.set(0, _thumbPath)
|
||||||
// fileFormat: 2,
|
const thumbMd5 = await calculateFileMD5(_thumbPath);
|
||||||
// import_rich_media_context: null,
|
let element: SendVideoElement = {
|
||||||
// sourceVideoCodecFormat: 2
|
elementType: ElementType.VIDEO,
|
||||||
}
|
elementId: "",
|
||||||
}
|
videoElement: {
|
||||||
return element;
|
fileName: fileName || _fileName,
|
||||||
|
filePath: path,
|
||||||
|
videoMd5: md5,
|
||||||
|
thumbMd5,
|
||||||
|
fileTime: videoInfo.time,
|
||||||
|
thumbPath: thumbPath,
|
||||||
|
thumbSize,
|
||||||
|
thumbWidth: videoInfo.width,
|
||||||
|
thumbHeight: videoInfo.height,
|
||||||
|
fileSize: "" + fileSize,
|
||||||
|
// fileUuid: "",
|
||||||
|
// transferStatus: 0,
|
||||||
|
// progress: 0,
|
||||||
|
// invalidState: 0,
|
||||||
|
// fileSubId: "",
|
||||||
|
// fileBizId: null,
|
||||||
|
// originVideoMd5: "",
|
||||||
|
// fileFormat: 2,
|
||||||
|
// import_rich_media_context: null,
|
||||||
|
// sourceVideoCodecFormat: 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
log("videoElement", element)
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
static async ptt(pttPath: string): Promise<SendPttElement> {
|
static async ptt(pttPath: string): Promise<SendPttElement> {
|
||||||
const {converted, path: silkPath, duration} = await encodeSilk(pttPath);
|
const {converted, path: silkPath, duration} = await encodeSilk(pttPath);
|
||||||
// log("生成语音", silkPath, duration);
|
// log("生成语音", silkPath, duration);
|
||||||
const {md5, fileName, path, fileSize} = await NTQQFileApi.uploadFile(silkPath, ElementType.PTT);
|
const {md5, fileName, path, fileSize} = await NTQQFileApi.uploadFile(silkPath, ElementType.PTT);
|
||||||
if (fileSize === 0) {
|
if (fileSize === 0) {
|
||||||
throw "文件异常,大小为0";
|
throw "文件异常,大小为0";
|
||||||
}
|
|
||||||
if (converted) {
|
|
||||||
fs.unlink(silkPath).then();
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
elementType: ElementType.PTT,
|
|
||||||
elementId: "",
|
|
||||||
pttElement: {
|
|
||||||
fileName: fileName,
|
|
||||||
filePath: path,
|
|
||||||
md5HexStr: md5,
|
|
||||||
fileSize: fileSize,
|
|
||||||
// duration: Math.max(1, Math.round(fileSize / 1024 / 3)), // 一秒钟大概是3kb大小, 小于1秒的按1秒算
|
|
||||||
duration: duration,
|
|
||||||
formatType: 1,
|
|
||||||
voiceType: 1,
|
|
||||||
voiceChangeType: 0,
|
|
||||||
canConvert2Text: true,
|
|
||||||
waveAmplitudes: [
|
|
||||||
0, 18, 9, 23, 16, 17, 16, 15, 44, 17, 24, 20, 14, 15, 17,
|
|
||||||
],
|
|
||||||
fileSubId: "",
|
|
||||||
playState: 1,
|
|
||||||
autoConvertText: 0,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
if (converted) {
|
||||||
static face(faceId: number): SendFaceElement {
|
fs.unlink(silkPath).then();
|
||||||
return {
|
|
||||||
elementType: ElementType.FACE,
|
|
||||||
elementId: "",
|
|
||||||
faceElement: {
|
|
||||||
faceIndex: faceId,
|
|
||||||
faceType: FaceType.normal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return {
|
||||||
|
elementType: ElementType.PTT,
|
||||||
|
elementId: "",
|
||||||
|
pttElement: {
|
||||||
|
fileName: fileName,
|
||||||
|
filePath: path,
|
||||||
|
md5HexStr: md5,
|
||||||
|
fileSize: fileSize,
|
||||||
|
// duration: Math.max(1, Math.round(fileSize / 1024 / 3)), // 一秒钟大概是3kb大小, 小于1秒的按1秒算
|
||||||
|
duration: duration,
|
||||||
|
formatType: 1,
|
||||||
|
voiceType: 1,
|
||||||
|
voiceChangeType: 0,
|
||||||
|
canConvert2Text: true,
|
||||||
|
waveAmplitudes: [
|
||||||
|
0, 18, 9, 23, 16, 17, 16, 15, 44, 17, 24, 20, 14, 15, 17,
|
||||||
|
],
|
||||||
|
fileSubId: "",
|
||||||
|
playState: 1,
|
||||||
|
autoConvertText: 0,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
static dice(resultId: number|null): SendFaceElement{
|
static face(faceId: number): SendFaceElement {
|
||||||
// 实际测试并不能控制结果
|
return {
|
||||||
|
elementType: ElementType.FACE,
|
||||||
// 随机1到6
|
elementId: "",
|
||||||
if (isNull(resultId)) resultId = Math.floor(Math.random() * 6) + 1;
|
faceElement: {
|
||||||
return {
|
faceIndex: faceId,
|
||||||
elementType: ElementType.FACE,
|
faceType: FaceType.normal
|
||||||
elementId: "",
|
}
|
||||||
faceElement: {
|
|
||||||
faceIndex: 358,
|
|
||||||
faceType: FaceType.dice,
|
|
||||||
"faceText": "[骰子]",
|
|
||||||
"packId": "1",
|
|
||||||
"stickerId": "33",
|
|
||||||
"sourceType": 1,
|
|
||||||
"stickerType": 2,
|
|
||||||
resultId: resultId.toString(),
|
|
||||||
"surpriseId": "",
|
|
||||||
// "randomType": 1,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 猜拳(石头剪刀布)表情
|
static dice(resultId: number | null): SendFaceElement {
|
||||||
static rps(resultId: number | null): SendFaceElement{
|
// 实际测试并不能控制结果
|
||||||
// 实际测试并不能控制结果
|
|
||||||
if (isNull(resultId)) resultId = Math.floor(Math.random() * 3) + 1;
|
|
||||||
return {
|
|
||||||
elementType: ElementType.FACE,
|
|
||||||
elementId: "",
|
|
||||||
faceElement: {
|
|
||||||
"faceIndex": 359,
|
|
||||||
"faceText": "[包剪锤]",
|
|
||||||
"faceType": 3,
|
|
||||||
"packId": "1",
|
|
||||||
"stickerId": "34",
|
|
||||||
"sourceType": 1,
|
|
||||||
"stickerType": 2,
|
|
||||||
"resultId": resultId.toString(),
|
|
||||||
"surpriseId": "",
|
|
||||||
// "randomType": 1,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static ark(data: any): SendArkElement {
|
// 随机1到6
|
||||||
return {
|
if (isNull(resultId)) resultId = Math.floor(Math.random() * 6) + 1;
|
||||||
elementType: ElementType.ARK,
|
return {
|
||||||
elementId: "",
|
elementType: ElementType.FACE,
|
||||||
arkElement: {
|
elementId: "",
|
||||||
bytesData: data,
|
faceElement: {
|
||||||
linkInfo: null,
|
faceIndex: 358,
|
||||||
subElementType: null
|
faceType: FaceType.dice,
|
||||||
}
|
"faceText": "[骰子]",
|
||||||
}
|
"packId": "1",
|
||||||
|
"stickerId": "33",
|
||||||
|
"sourceType": 1,
|
||||||
|
"stickerType": 2,
|
||||||
|
resultId: resultId.toString(),
|
||||||
|
"surpriseId": "",
|
||||||
|
// "randomType": 1,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 猜拳(石头剪刀布)表情
|
||||||
|
static rps(resultId: number | null): SendFaceElement {
|
||||||
|
// 实际测试并不能控制结果
|
||||||
|
if (isNull(resultId)) resultId = Math.floor(Math.random() * 3) + 1;
|
||||||
|
return {
|
||||||
|
elementType: ElementType.FACE,
|
||||||
|
elementId: "",
|
||||||
|
faceElement: {
|
||||||
|
"faceIndex": 359,
|
||||||
|
"faceText": "[包剪锤]",
|
||||||
|
"faceType": 3,
|
||||||
|
"packId": "1",
|
||||||
|
"stickerId": "34",
|
||||||
|
"sourceType": 1,
|
||||||
|
"stickerType": 2,
|
||||||
|
"resultId": resultId.toString(),
|
||||||
|
"surpriseId": "",
|
||||||
|
// "randomType": 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static ark(data: any): SendArkElement {
|
||||||
|
return {
|
||||||
|
elementType: ElementType.ARK,
|
||||||
|
elementId: "",
|
||||||
|
arkElement: {
|
||||||
|
bytesData: data,
|
||||||
|
linkInfo: null,
|
||||||
|
subElementType: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
import {OB11Message, OB11MessageAt, OB11MessageData} from "../types";
|
import {OB11Message, OB11MessageAt, OB11MessageData} from "../types";
|
||||||
import {getGroup, selfInfo} from "../../common/data";
|
import {getFriend, getGroup, getUidByUin, selfInfo} from "../../common/data";
|
||||||
import {OB11BaseMetaEvent} from "../event/meta/OB11BaseMetaEvent";
|
import {OB11BaseMetaEvent} from "../event/meta/OB11BaseMetaEvent";
|
||||||
import {OB11BaseNoticeEvent} from "../event/notice/OB11BaseNoticeEvent";
|
import {OB11BaseNoticeEvent} from "../event/notice/OB11BaseNoticeEvent";
|
||||||
import {WebSocket as WebSocketClass} from "ws";
|
import {WebSocket as WebSocketClass} from "ws";
|
||||||
@ -115,6 +115,7 @@ export function postOB11Event(msg: PostEventType, reportSelf = false) {
|
|||||||
peerUid: msg.user_id.toString()
|
peerUid: msg.user_id.toString()
|
||||||
}
|
}
|
||||||
if (msg.message_type == "private") {
|
if (msg.message_type == "private") {
|
||||||
|
peer.peerUid = getUidByUin(msg.user_id.toString())
|
||||||
if (msg.sub_type === "group") {
|
if (msg.sub_type === "group") {
|
||||||
peer.chatType = ChatType.temp
|
peer.chatType = ChatType.temp
|
||||||
}
|
}
|
||||||
@ -139,6 +140,7 @@ export function postOB11Event(msg: PostEventType, reportSelf = false) {
|
|||||||
}
|
}
|
||||||
replyMessage = replyMessage.concat(convertMessage2List(reply, resJson.auto_escape))
|
replyMessage = replyMessage.concat(convertMessage2List(reply, resJson.auto_escape))
|
||||||
const {sendElements, deleteAfterSentFiles} = await createSendElements(replyMessage, group)
|
const {sendElements, deleteAfterSentFiles} = await createSendElements(replyMessage, group)
|
||||||
|
log(`发送消息给`, peer, sendElements)
|
||||||
sendMsg(peer, sendElements, deleteAfterSentFiles, false).then()
|
sendMsg(peer, sendElements, deleteAfterSentFiles, false).then()
|
||||||
} else if (resJson.delete) {
|
} else if (resJson.delete) {
|
||||||
NTQQMsgApi.recallMsg(peer, [rawMessage.msgId]).then()
|
NTQQMsgApi.recallMsg(peer, [rawMessage.msgId]).then()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user