mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
commit
addcedc588
@ -30,7 +30,6 @@
|
|||||||
"typescript": "^5.3.3",
|
"typescript": "^5.3.3",
|
||||||
"vite": "^5.2.6",
|
"vite": "^5.2.6",
|
||||||
"vite-plugin-cp": "^4.0.8",
|
"vite-plugin-cp": "^4.0.8",
|
||||||
"vite-plugin-dts": "^3.8.2",
|
|
||||||
"vite-tsconfig-paths": "^4.3.2"
|
"vite-tsconfig-paths": "^4.3.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -49,7 +48,6 @@
|
|||||||
"protobufjs": "~7.4.0",
|
"protobufjs": "~7.4.0",
|
||||||
"qrcode-terminal": "^0.12.0",
|
"qrcode-terminal": "^0.12.0",
|
||||||
"silk-wasm": "^3.6.1",
|
"silk-wasm": "^3.6.1",
|
||||||
"strtok3": "8.0.1",
|
|
||||||
"ws": "^8.18.0"
|
"ws": "^8.18.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -139,8 +139,7 @@ export class LogWrapper {
|
|||||||
|
|
||||||
logMessage(msg: RawMessage, selfInfo: SelfInfo) {
|
logMessage(msg: RawMessage, selfInfo: SelfInfo) {
|
||||||
const isSelfSent = msg.senderUin === selfInfo.uin;
|
const isSelfSent = msg.senderUin === selfInfo.uin;
|
||||||
this.log(`${
|
this.log(`${isSelfSent ? '发送 ->' : '接收 <-'
|
||||||
isSelfSent ? '发送 ->' : '接收 <-'
|
|
||||||
} ${rawMessageToText(msg)}`);
|
} ${rawMessageToText(msg)}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,12 +179,11 @@ export function rawMessageToText(msg: RawMessage, recursiveLevel = 0): string {
|
|||||||
const recordMsgOrNull = msg.records.find(
|
const recordMsgOrNull = msg.records.find(
|
||||||
record => element.replyElement!.sourceMsgIdInRecords === record.msgId,
|
record => element.replyElement!.sourceMsgIdInRecords === record.msgId,
|
||||||
);
|
);
|
||||||
return `[回复消息 ${
|
return `[回复消息 ${recordMsgOrNull &&
|
||||||
recordMsgOrNull &&
|
recordMsgOrNull.peerUin != '284840486' && recordMsgOrNull.peerUin != '1094950020'// 非转发消息; 否则定位不到
|
||||||
recordMsgOrNull.peerUin != '284840486' // 非转发消息; 否则定位不到
|
?
|
||||||
?
|
rawMessageToText(recordMsgOrNull, recursiveLevel + 1) :
|
||||||
rawMessageToText(recordMsgOrNull, recursiveLevel + 1) :
|
`未找到消息记录 (MsgId = ${element.replyElement.sourceMsgIdInRecords})`
|
||||||
`未找到消息记录 (MsgId = ${element.replyElement.sourceMsgIdInRecords})`
|
|
||||||
}]`;
|
}]`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,7 +659,8 @@ export interface GrayTipElement {
|
|||||||
export enum FaceType {
|
export enum FaceType {
|
||||||
normal = 1, // 小黄脸
|
normal = 1, // 小黄脸
|
||||||
normal2 = 2, // 新小黄脸, 从faceIndex 222开始?
|
normal2 = 2, // 新小黄脸, 从faceIndex 222开始?
|
||||||
dice = 3 // 骰子
|
dice = 3, // 骰子
|
||||||
|
poke = 5 // 拍一拍
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum FaceIndex {
|
export enum FaceIndex {
|
||||||
|
@ -260,15 +260,15 @@ export async function genSessionConfig(
|
|||||||
//os.platform()
|
//os.platform()
|
||||||
let systemPlatform = PlatformType.KWINDOWS;
|
let systemPlatform = PlatformType.KWINDOWS;
|
||||||
switch (os.platform()) {
|
switch (os.platform()) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
systemPlatform = PlatformType.KWINDOWS;
|
systemPlatform = PlatformType.KWINDOWS;
|
||||||
break;
|
break;
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
systemPlatform = PlatformType.KMAC;
|
systemPlatform = PlatformType.KMAC;
|
||||||
break;
|
break;
|
||||||
case 'linux':
|
case 'linux':
|
||||||
systemPlatform = PlatformType.KLINUX;
|
systemPlatform = PlatformType.KLINUX;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
selfUin,
|
selfUin,
|
||||||
|
@ -240,7 +240,12 @@ export interface NodeIKernelGroupService {
|
|||||||
|
|
||||||
getGroupRecommendContactArkJson(groupCode: string): unknown;
|
getGroupRecommendContactArkJson(groupCode: string): unknown;
|
||||||
|
|
||||||
getJoinGroupLink(groupCode: string): unknown;
|
getJoinGroupLink(param: {
|
||||||
|
groupCode: string,
|
||||||
|
srcId: number,//73
|
||||||
|
needShortUrl: boolean,//true
|
||||||
|
additionalParam: string//''
|
||||||
|
}): Promise<GeneralCallResult & { url?: string }>;
|
||||||
|
|
||||||
modifyGroupExtInfo(groupCode: string, arg: unknown): void;
|
modifyGroupExtInfo(groupCode: string, arg: unknown): void;
|
||||||
|
|
||||||
|
@ -15,14 +15,14 @@ export class OneBotFriendApi {
|
|||||||
//使用前预先判断 busiId 1061
|
//使用前预先判断 busiId 1061
|
||||||
async parsePrivatePokeEvent(grayTipElement: GrayTipElement) {
|
async parsePrivatePokeEvent(grayTipElement: GrayTipElement) {
|
||||||
const json = JSON.parse(grayTipElement.jsonGrayTipElement.jsonStr);
|
const json = JSON.parse(grayTipElement.jsonGrayTipElement.jsonStr);
|
||||||
let pokedetail: any[] = json.items;
|
let pokedetail: Array<{ uid: string }> = json.items;
|
||||||
//筛选item带有uid的元素
|
//筛选item带有uid的元素
|
||||||
pokedetail = pokedetail.filter(item => item.uid);
|
pokedetail = pokedetail.filter(item => item.uid);
|
||||||
if (pokedetail.length == 2) {
|
if (pokedetail.length == 2) {
|
||||||
return new OB11FriendPokeEvent(
|
return new OB11FriendPokeEvent(
|
||||||
this.core,
|
this.core,
|
||||||
parseInt((await this.core.apis.UserApi.getUinByUidV2(pokedetail[0].uid))!),
|
parseInt((await this.core.apis.UserApi.getUinByUidV2(pokedetail[0].uid))),
|
||||||
parseInt((await this.core.apis.UserApi.getUinByUidV2(pokedetail[1].uid))!),
|
parseInt((await this.core.apis.UserApi.getUinByUidV2(pokedetail[1].uid))),
|
||||||
pokedetail,
|
pokedetail,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,6 @@ export class OneBotGroupApi {
|
|||||||
if (GroupIncreaseEvent) return GroupIncreaseEvent;
|
if (GroupIncreaseEvent) return GroupIncreaseEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
//代码歧义 GrayTipElementSubType.MEMBER_NEW_TITLE
|
|
||||||
else if (element.grayTipElement.subElementType == NTGrayTipElementSubTypeV2.GRAYTIP_ELEMENT_SUBTYPE_JSON) {
|
else if (element.grayTipElement.subElementType == NTGrayTipElementSubTypeV2.GRAYTIP_ELEMENT_SUBTYPE_JSON) {
|
||||||
const json = JSON.parse(element.grayTipElement.jsonGrayTipElement.jsonStr);
|
const json = JSON.parse(element.grayTipElement.jsonGrayTipElement.jsonStr);
|
||||||
if (element.grayTipElement.jsonGrayTipElement.busiId == 1061) {
|
if (element.grayTipElement.jsonGrayTipElement.busiId == 1061) {
|
||||||
@ -139,7 +138,6 @@ export class OneBotGroupApi {
|
|||||||
// 获取MsgSeq+Peer可获取具体消息
|
// 获取MsgSeq+Peer可获取具体消息
|
||||||
}
|
}
|
||||||
if (element.grayTipElement.jsonGrayTipElement.busiId == 2407) {
|
if (element.grayTipElement.jsonGrayTipElement.busiId == 2407) {
|
||||||
//下面得改 上面也是错的grayTipElement.subElementType == GrayTipElementSubType.MEMBER_NEW_TITLE
|
|
||||||
const type = json.items[json.items.length - 1]?.txt;
|
const type = json.items[json.items.length - 1]?.txt;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "头衔": {
|
case "头衔": {
|
||||||
@ -207,7 +205,6 @@ export class OneBotGroupApi {
|
|||||||
while ((match = regex.exec(xmlElement.content)) !== null) {
|
while ((match = regex.exec(xmlElement.content)) !== null) {
|
||||||
matches.push(match[1]);
|
matches.push(match[1]);
|
||||||
}
|
}
|
||||||
// log("新人进群匹配到的QQ号", matches)
|
|
||||||
if (matches.length === 2) {
|
if (matches.length === 2) {
|
||||||
const [inviter, invitee] = matches;
|
const [inviter, invitee] = matches;
|
||||||
return new OB11GroupIncreaseEvent(
|
return new OB11GroupIncreaseEvent(
|
||||||
|
@ -212,7 +212,7 @@ export class OneBotMsgApi {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (records.peerUin === '284840486') {
|
if (records.peerUin === '284840486' || records.peerUin === '1094950020') {
|
||||||
return createReplyData(records.msgId);
|
return createReplyData(records.msgId);
|
||||||
}
|
}
|
||||||
const replyMsg = (await this.core.apis.MsgApi.queryMsgsWithFilterExWithSeqV2(peer, element.replayMsgSeq, element.replyMsgTime, [element.senderUidStr]))
|
const replyMsg = (await this.core.apis.MsgApi.queryMsgsWithFilterExWithSeqV2(peer, element.replayMsgSeq, element.replyMsgTime, [element.senderUidStr]))
|
||||||
@ -234,19 +234,29 @@ export class OneBotMsgApi {
|
|||||||
//读取视频链接并兜底
|
//读取视频链接并兜底
|
||||||
let videoUrlWrappers: Awaited<ReturnType<typeof this.core.apis.FileApi.getVideoUrl>> | undefined;
|
let videoUrlWrappers: Awaited<ReturnType<typeof this.core.apis.FileApi.getVideoUrl>> | undefined;
|
||||||
|
|
||||||
if (msg.peerUin === '284840486') {
|
if (msg.peerUin === '284840486' || msg.peerUin === '1094950020') {
|
||||||
//TODO: 合并消息内部 应该进行特殊处理 可能需要重写peer 待测试与研究 Mlikiowa Tagged
|
try {
|
||||||
}
|
videoUrlWrappers = await this.core.apis.FileApi.getVideoUrl({
|
||||||
try {
|
chatType: msg.chatType,
|
||||||
videoUrlWrappers = await this.core.apis.FileApi.getVideoUrl({
|
peerUid: msg.peerUid,
|
||||||
chatType: msg.chatType,
|
guildId: '0',
|
||||||
peerUid: msg.peerUid,
|
}, msg.parentMsgIdList[0] ?? msg.msgId, elementWrapper.elementId);
|
||||||
guildId: '0',
|
} catch (error) {
|
||||||
}, msg.msgId, elementWrapper.elementId);
|
this.core.context.logger.logWarn('合并获取视频 URL 失败');
|
||||||
} catch (error) {
|
}
|
||||||
this.core.context.logger.logWarn('获取视频 URL 失败');
|
} else {
|
||||||
|
try {
|
||||||
|
videoUrlWrappers = await this.core.apis.FileApi.getVideoUrl({
|
||||||
|
chatType: msg.chatType,
|
||||||
|
peerUid: msg.peerUid,
|
||||||
|
guildId: '0',
|
||||||
|
}, msg.msgId, elementWrapper.elementId);
|
||||||
|
} catch (error) {
|
||||||
|
this.core.context.logger.logWarn('获取视频 URL 失败');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//读取在线URL
|
//读取在线URL
|
||||||
let videoDownUrl: string | undefined;
|
let videoDownUrl: string | undefined;
|
||||||
|
|
||||||
@ -447,7 +457,6 @@ export class OneBotMsgApi {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
[OB11MessageDataType.mface]: async ({
|
[OB11MessageDataType.mface]: async ({
|
||||||
data: {
|
data: {
|
||||||
emoji_package_id, emoji_id, key, summary,
|
emoji_package_id, emoji_id, key, summary,
|
||||||
@ -510,13 +519,12 @@ export class OneBotMsgApi {
|
|||||||
faceElement: {
|
faceElement: {
|
||||||
faceIndex: FaceIndex.dice,
|
faceIndex: FaceIndex.dice,
|
||||||
faceType: FaceType.dice,
|
faceType: FaceType.dice,
|
||||||
'faceText': '[骰子]',
|
faceText: '[骰子]',
|
||||||
'packId': '1',
|
packId: '1',
|
||||||
'stickerId': '33',
|
stickerId: '33',
|
||||||
'sourceType': 1,
|
sourceType: 1,
|
||||||
'stickerType': 2,
|
stickerType: 2,
|
||||||
// resultId: resultId.toString(),
|
surpriseId: '',
|
||||||
'surpriseId': '',
|
|
||||||
// "randomType": 1,
|
// "randomType": 1,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@ -525,15 +533,14 @@ export class OneBotMsgApi {
|
|||||||
elementType: ElementType.FACE,
|
elementType: ElementType.FACE,
|
||||||
elementId: '',
|
elementId: '',
|
||||||
faceElement: {
|
faceElement: {
|
||||||
'faceIndex': FaceIndex.RPS,
|
faceIndex: FaceIndex.RPS,
|
||||||
'faceText': '[包剪锤]',
|
faceText: '[包剪锤]',
|
||||||
'faceType': 3,
|
faceType: 3,
|
||||||
'packId': '1',
|
packId: '1',
|
||||||
'stickerId': '34',
|
stickerId: '34',
|
||||||
'sourceType': 1,
|
sourceType: 1,
|
||||||
'stickerType': 2,
|
stickerType: 2,
|
||||||
// 'resultId': resultId.toString(),
|
surpriseId: '',
|
||||||
'surpriseId': '',
|
|
||||||
// "randomType": 1,
|
// "randomType": 1,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
@ -72,15 +72,15 @@ export async function NCoreInitShell() {
|
|||||||
})();
|
})();
|
||||||
let systemPlatform = PlatformType.KWINDOWS;
|
let systemPlatform = PlatformType.KWINDOWS;
|
||||||
switch (os.platform()) {
|
switch (os.platform()) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
systemPlatform = PlatformType.KWINDOWS;
|
systemPlatform = PlatformType.KWINDOWS;
|
||||||
break;
|
break;
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
systemPlatform = PlatformType.KMAC;
|
systemPlatform = PlatformType.KMAC;
|
||||||
break;
|
break;
|
||||||
case 'linux':
|
case 'linux':
|
||||||
systemPlatform = PlatformType.KLINUX;
|
systemPlatform = PlatformType.KLINUX;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!basicInfoWrapper.QQVersionAppid || !basicInfoWrapper.QQVersionQua) throw new Error('QQVersionAppid or QQVersionQua is not defined');
|
if (!basicInfoWrapper.QQVersionAppid || !basicInfoWrapper.QQVersionQua) throw new Error('QQVersionAppid or QQVersionQua is not defined');
|
||||||
// from initConfig
|
// from initConfig
|
||||||
@ -119,7 +119,7 @@ export async function NCoreInitShell() {
|
|||||||
quickLoginUin = '';
|
quickLoginUin = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let dataTimestape = new Date().getTime().toString();
|
const dataTimestape = new Date().getTime().toString();
|
||||||
o3Service.reportAmgomWeather('login', 'a1', [dataTimestape, '0', '0']);
|
o3Service.reportAmgomWeather('login', 'a1', [dataTimestape, '0', '0']);
|
||||||
const selfInfo = await new Promise<SelfInfo>((resolve) => {
|
const selfInfo = await new Promise<SelfInfo>((resolve) => {
|
||||||
const loginListener = new NodeIKernelLoginListener();
|
const loginListener = new NodeIKernelLoginListener();
|
||||||
@ -234,13 +234,13 @@ export async function NCoreInitShell() {
|
|||||||
logger.log(`可用于快速登录的 QQ:\n${historyLoginList
|
logger.log(`可用于快速登录的 QQ:\n${historyLoginList
|
||||||
.map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`)
|
.map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`)
|
||||||
.join('\n')
|
.join('\n')
|
||||||
}`);
|
}`);
|
||||||
}
|
}
|
||||||
loginService.getQRCodePicture();
|
loginService.getQRCodePicture();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// BEFORE LOGGING IN
|
// BEFORE LOGGING IN
|
||||||
let amgomDataPiece = 'eb1fd6ac257461580dc7438eb099f23aae04ca679f4d88f53072dc56e3bb1129';
|
const amgomDataPiece = 'eb1fd6ac257461580dc7438eb099f23aae04ca679f4d88f53072dc56e3bb1129';
|
||||||
o3Service.setAmgomDataPiece(basicInfoWrapper.QQVersionAppid, new Uint8Array(Buffer.from(amgomDataPiece, 'hex')));
|
o3Service.setAmgomDataPiece(basicInfoWrapper.QQVersionAppid, new Uint8Array(Buffer.from(amgomDataPiece, 'hex')));
|
||||||
// AFTER LOGGING IN
|
// AFTER LOGGING IN
|
||||||
//99b15bdb4c984fc69d5aa1feb9aa16xx --> 99b15bdb-4c98-4fc6-9d5a-a1feb9aa16xx
|
//99b15bdb4c984fc69d5aa1feb9aa16xx --> 99b15bdb-4c98-4fc6-9d5a-a1feb9aa16xx
|
||||||
|
Loading…
x
Reference in New Issue
Block a user