mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-03-01 16:20:25 +00:00
chore: run a full eslint
This commit is contained in:
@@ -1,40 +1,41 @@
|
||||
import { ConfigBase } from '@/common/utils/ConfigBase';
|
||||
|
||||
export interface OB11Config {
|
||||
http: {
|
||||
enable: boolean;
|
||||
host: string;
|
||||
port: number;
|
||||
secret: string;
|
||||
enableHeart: boolean;
|
||||
enablePost: boolean;
|
||||
postUrls: string[];
|
||||
};
|
||||
ws: {
|
||||
enable: boolean;
|
||||
host: string;
|
||||
port: number;
|
||||
};
|
||||
reverseWs: {
|
||||
enable: boolean;
|
||||
urls: string[];
|
||||
};
|
||||
http: {
|
||||
enable: boolean;
|
||||
host: string;
|
||||
port: number;
|
||||
secret: string;
|
||||
enableHeart: boolean;
|
||||
enablePost: boolean;
|
||||
postUrls: string[];
|
||||
};
|
||||
ws: {
|
||||
enable: boolean;
|
||||
host: string;
|
||||
port: number;
|
||||
};
|
||||
reverseWs: {
|
||||
enable: boolean;
|
||||
urls: string[];
|
||||
};
|
||||
|
||||
debug: boolean;
|
||||
heartInterval: number;
|
||||
messagePostFormat: 'array' | 'string';
|
||||
enableLocalFile2Url: boolean;
|
||||
musicSignUrl: string;
|
||||
reportSelfMessage: boolean;
|
||||
token: string;
|
||||
GroupLocalTime: {
|
||||
Record: boolean,
|
||||
RecordList: Array<string>
|
||||
}
|
||||
debug: boolean;
|
||||
heartInterval: number;
|
||||
messagePostFormat: 'array' | 'string';
|
||||
enableLocalFile2Url: boolean;
|
||||
musicSignUrl: string;
|
||||
reportSelfMessage: boolean;
|
||||
token: string;
|
||||
GroupLocalTime: {
|
||||
Record: boolean,
|
||||
RecordList: Array<string>
|
||||
};
|
||||
}
|
||||
|
||||
export class OB11Config extends ConfigBase<OB11Config> {
|
||||
export class OB11Config extends ConfigBase<OB11Config> {
|
||||
name = 'onebot11';
|
||||
|
||||
protected getKeys(): string[] | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import fastXmlParser, { XMLParser } from 'fast-xml-parser';
|
||||
import fastXmlParser from 'fast-xml-parser';
|
||||
import {
|
||||
OB11Group,
|
||||
OB11GroupMember,
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
OB11MessageData,
|
||||
OB11MessageDataType,
|
||||
OB11User,
|
||||
OB11UserSex
|
||||
OB11UserSex,
|
||||
} from '../types';
|
||||
import {
|
||||
AtType,
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
Sex,
|
||||
TipGroupElementType,
|
||||
User,
|
||||
VideoElement
|
||||
VideoElement,
|
||||
} from '@/core/entities';
|
||||
import { EventType } from '../event/OB11BaseEvent';
|
||||
import { encodeCQCode } from './cqcode';
|
||||
@@ -32,12 +32,9 @@ import { OB11GroupIncreaseEvent } from '../event/notice/OB11GroupIncreaseEvent';
|
||||
import { OB11GroupBanEvent } from '../event/notice/OB11GroupBanEvent';
|
||||
import { OB11GroupUploadNoticeEvent } from '../event/notice/OB11GroupUploadNoticeEvent';
|
||||
import { OB11GroupNoticeEvent } from '../event/notice/OB11GroupNoticeEvent';
|
||||
import { calcQQLevel } from '@/common/utils/helper';
|
||||
import { sleep, UUIDConverter } from '@/common/utils/helper';
|
||||
import { calcQQLevel, sleep, UUIDConverter } from '@/common/utils/helper';
|
||||
import { OB11GroupTitleEvent } from '../event/notice/OB11GroupTitleEvent';
|
||||
import { OB11GroupCardEvent } from '../event/notice/OB11GroupCardEvent';
|
||||
import { OB11GroupDecreaseEvent } from '../event/notice/OB11GroupDecreaseEvent';
|
||||
import { NTQQFileApi, NTQQGroupApi, NTQQMsgApi, NTQQUserApi } from '@/core/apis';
|
||||
import { OB11GroupMsgEmojiLikeEvent } from '@/onebot/event/notice/OB11MsgEmojiLikeEvent';
|
||||
import { OB11FriendPokeEvent, OB11GroupPokeEvent } from '../event/notice/OB11PokeEvent';
|
||||
import { OB11FriendAddNoticeEvent } from '../event/notice/OB11FriendAddNoticeEvent';
|
||||
@@ -86,28 +83,25 @@ export class OB11Constructor {
|
||||
resMsg.sender.role = OB11Constructor.groupMemberRole(member.role);
|
||||
resMsg.sender.nickname = member.nick;
|
||||
}
|
||||
}
|
||||
else if (msg.chatType == ChatType.friend) {
|
||||
} else if (msg.chatType == ChatType.friend) {
|
||||
resMsg.sub_type = 'friend';
|
||||
resMsg.sender.nickname = (await NTQQUserApi.getUserDetailInfo(msg.senderUid)).nick;
|
||||
//const user = await NTQQUserApi.getUserDetailInfoByUin(msg.senderUin!);
|
||||
//resMsg.sender.nickname = user.info.nick;
|
||||
}
|
||||
else if (msg.chatType == ChatType.temp) {
|
||||
} else if (msg.chatType == ChatType.temp) {
|
||||
resMsg.sub_type = 'group';
|
||||
}
|
||||
for (const element of msg.elements) {
|
||||
let message_data: OB11MessageData = {
|
||||
data: {} as any,
|
||||
type: 'unknown' as any
|
||||
type: 'unknown' as any,
|
||||
};
|
||||
if (element.textElement && element.textElement?.atType !== AtType.notAt) {
|
||||
let qq: `${number}` | 'all';
|
||||
let name: string | undefined;
|
||||
if (element.textElement.atType == AtType.atAll) {
|
||||
qq = 'all';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
const { atNtUid, content } = element.textElement;
|
||||
let atQQ = element.textElement.atUid;
|
||||
if (!atQQ || atQQ === '0') {
|
||||
@@ -122,11 +116,10 @@ export class OB11Constructor {
|
||||
type: OB11MessageDataType.at,
|
||||
data: {
|
||||
qq: qq!,
|
||||
name
|
||||
}
|
||||
name,
|
||||
},
|
||||
};
|
||||
}
|
||||
else if (element.textElement) {
|
||||
} else if (element.textElement) {
|
||||
message_data['type'] = OB11MessageDataType.text;
|
||||
|
||||
let text = element.textElement.content;
|
||||
@@ -138,8 +131,7 @@ export class OB11Constructor {
|
||||
text = text.replace(/\r/g, '\n');
|
||||
}
|
||||
message_data['data']['text'] = text;
|
||||
}
|
||||
else if (element.replyElement) {
|
||||
} else if (element.replyElement) {
|
||||
message_data['type'] = OB11MessageDataType.reply;
|
||||
//log("收到回复消息", element.replyElement);
|
||||
try {
|
||||
@@ -151,7 +143,11 @@ export class OB11Constructor {
|
||||
};
|
||||
let replyMsg: RawMessage | undefined;
|
||||
if (!records) throw new Error('找不到回复消息');
|
||||
replyMsg = (await NTQQMsgApi.getMsgsBySeqAndCount({ peerUid: msg.peerUid, guildId: '', chatType: msg.chatType }, element.replyElement.replayMsgSeq, 1, true, true)).msgList[0];
|
||||
replyMsg = (await NTQQMsgApi.getMsgsBySeqAndCount({
|
||||
peerUid: msg.peerUid,
|
||||
guildId: '',
|
||||
chatType: msg.chatType,
|
||||
}, element.replyElement.replayMsgSeq, 1, true, true)).msgList[0];
|
||||
if (!replyMsg || records.msgRandom !== replyMsg.msgRandom) {
|
||||
replyMsg = (await NTQQMsgApi.getSingleMsg(peer, element.replyElement.replayMsgSeq)).msgList[0];
|
||||
}
|
||||
@@ -161,7 +157,11 @@ export class OB11Constructor {
|
||||
if ((!replyMsg || records.msgRandom !== replyMsg.msgRandom) && msg.peerUin !== '284840486') {
|
||||
throw new Error('回复消息消息验证失败');
|
||||
}
|
||||
message_data['data']['id'] = MessageUnique.createMsg({ peerUid: msg.peerUid, guildId: '', chatType: msg.chatType }, replyMsg.msgId)?.toString();
|
||||
message_data['data']['id'] = MessageUnique.createMsg({
|
||||
peerUid: msg.peerUid,
|
||||
guildId: '',
|
||||
chatType: msg.chatType,
|
||||
}, replyMsg.msgId)?.toString();
|
||||
//log("找到回复消息", message_data['data']['id'], replyMsg.msgList[0].msgId)
|
||||
} catch (e: any) {
|
||||
message_data['type'] = 'unknown' as any;
|
||||
@@ -169,8 +169,7 @@ export class OB11Constructor {
|
||||
logger.logError('获取不到引用的消息', e.stack, element.replyElement.replayMsgSeq);
|
||||
}
|
||||
|
||||
}
|
||||
else if (element.picElement) {
|
||||
} else if (element.picElement) {
|
||||
message_data['type'] = OB11MessageDataType.image;
|
||||
// message_data["data"]["file"] = element.picElement.sourcePath
|
||||
message_data['data']['file'] = element.picElement.fileName;
|
||||
@@ -186,8 +185,7 @@ export class OB11Constructor {
|
||||
//console.log(message_data['data']['url'])
|
||||
// message_data["data"]["file_id"] = element.picElement.fileUuid
|
||||
message_data['data']['file_size'] = element.picElement.fileSize;
|
||||
}
|
||||
else if (element.fileElement) {
|
||||
} else if (element.fileElement) {
|
||||
const FileElement = element.fileElement;
|
||||
message_data['type'] = OB11MessageDataType.file;
|
||||
message_data['data']['file'] = FileElement.fileName;
|
||||
@@ -195,21 +193,21 @@ export class OB11Constructor {
|
||||
message_data['data']['url'] = FileElement.filePath;
|
||||
message_data['data']['file_id'] = UUIDConverter.encode(msg.peerUin, msg.msgId);
|
||||
message_data['data']['file_size'] = FileElement.fileSize;
|
||||
await NTQQFileApi.addFileCache({
|
||||
peerUid: msg.peerUid,
|
||||
chatType: msg.chatType,
|
||||
guildId: '',
|
||||
},
|
||||
msg.msgId,
|
||||
msg.msgSeq,
|
||||
msg.senderUid,
|
||||
element.elementId,
|
||||
element.elementType.toString(),
|
||||
FileElement.fileSize,
|
||||
FileElement.fileName
|
||||
await NTQQFileApi.addFileCache(
|
||||
{
|
||||
peerUid: msg.peerUid,
|
||||
chatType: msg.chatType,
|
||||
guildId: '',
|
||||
},
|
||||
msg.msgId,
|
||||
msg.msgSeq,
|
||||
msg.senderUid,
|
||||
element.elementId,
|
||||
element.elementType.toString(),
|
||||
FileElement.fileSize,
|
||||
FileElement.fileName,
|
||||
);
|
||||
}
|
||||
else if (element.videoElement) {
|
||||
} else if (element.videoElement) {
|
||||
const videoElement: VideoElement = element.videoElement;
|
||||
//读取视频链接并兜底
|
||||
let videoUrl;//Array
|
||||
@@ -221,7 +219,7 @@ export class OB11Constructor {
|
||||
videoUrl = await NTQQFileApi.getVideoUrl({
|
||||
chatType: msg.chatType,
|
||||
peerUid: msg.peerUid,
|
||||
guildId: '0'
|
||||
guildId: '0',
|
||||
}, msg.msgId, element.elementId);
|
||||
} catch (error) {
|
||||
videoUrl = undefined;
|
||||
@@ -230,7 +228,12 @@ export class OB11Constructor {
|
||||
let videoDownUrl = undefined;
|
||||
|
||||
if (videoUrl) {
|
||||
const videoDownUrlTemp = videoUrl.find((url) => { if (url.url) { return true; } return false; });
|
||||
const videoDownUrlTemp = videoUrl.find((url) => {
|
||||
if (url.url) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (videoDownUrlTemp) {
|
||||
videoDownUrl = videoDownUrlTemp.url;
|
||||
}
|
||||
@@ -246,21 +249,21 @@ export class OB11Constructor {
|
||||
message_data['data']['file_id'] = UUIDConverter.encode(msg.peerUin, msg.msgId);
|
||||
message_data['data']['file_size'] = videoElement.fileSize;
|
||||
|
||||
await NTQQFileApi.addFileCache({
|
||||
peerUid: msg.peerUid,
|
||||
chatType: msg.chatType,
|
||||
guildId: '',
|
||||
},
|
||||
msg.msgId,
|
||||
msg.msgSeq,
|
||||
msg.senderUid,
|
||||
element.elementId,
|
||||
element.elementType.toString(),
|
||||
videoElement.fileSize || '0',
|
||||
videoElement.fileName
|
||||
await NTQQFileApi.addFileCache(
|
||||
{
|
||||
peerUid: msg.peerUid,
|
||||
chatType: msg.chatType,
|
||||
guildId: '',
|
||||
},
|
||||
msg.msgId,
|
||||
msg.msgSeq,
|
||||
msg.senderUid,
|
||||
element.elementId,
|
||||
element.elementType.toString(),
|
||||
videoElement.fileSize || '0',
|
||||
videoElement.fileName,
|
||||
);
|
||||
}
|
||||
else if (element.pttElement) {
|
||||
} else if (element.pttElement) {
|
||||
message_data['type'] = OB11MessageDataType.voice;
|
||||
message_data['data']['file'] = element.pttElement.fileName;
|
||||
message_data['data']['path'] = element.pttElement.filePath;
|
||||
@@ -278,30 +281,25 @@ export class OB11Constructor {
|
||||
element.elementId,
|
||||
element.elementType.toString(),
|
||||
element.pttElement.fileSize || '0',
|
||||
element.pttElement.fileUuid || ''
|
||||
element.pttElement.fileUuid || '',
|
||||
);
|
||||
//以uuid作为文件名
|
||||
}
|
||||
else if (element.arkElement) {
|
||||
} else if (element.arkElement) {
|
||||
message_data['type'] = OB11MessageDataType.json;
|
||||
message_data['data']['data'] = element.arkElement.bytesData;
|
||||
}
|
||||
else if (element.faceElement) {
|
||||
} else if (element.faceElement) {
|
||||
const faceId = element.faceElement.faceIndex;
|
||||
if (faceId === FaceIndex.dice) {
|
||||
message_data['type'] = OB11MessageDataType.dice;
|
||||
message_data['data']['result'] = element.faceElement.resultId;
|
||||
}
|
||||
else if (faceId === FaceIndex.RPS) {
|
||||
} else if (faceId === FaceIndex.RPS) {
|
||||
message_data['type'] = OB11MessageDataType.RPS;
|
||||
message_data['data']['result'] = element.faceElement.resultId;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
message_data['type'] = OB11MessageDataType.face;
|
||||
message_data['data']['id'] = element.faceElement.faceIndex.toString();
|
||||
}
|
||||
}
|
||||
else if (element.marketFaceElement) {
|
||||
} else if (element.marketFaceElement) {
|
||||
message_data['type'] = OB11MessageDataType.mface;
|
||||
message_data['data']['summary'] = element.marketFaceElement.faceName;
|
||||
const md5 = element.marketFaceElement.emojiId;
|
||||
@@ -315,15 +313,17 @@ export class OB11Constructor {
|
||||
message_data['data']['emoji_package_id'] = String(element.marketFaceElement.emojiPackageId);
|
||||
message_data['data']['key'] = element.marketFaceElement.key;
|
||||
//mFaceCache.set(md5, element.marketFaceElement.faceName);
|
||||
}
|
||||
else if (element.markdownElement) {
|
||||
} else if (element.markdownElement) {
|
||||
message_data['type'] = OB11MessageDataType.markdown;
|
||||
message_data['data']['data'] = element.markdownElement.content;
|
||||
}
|
||||
else if (element.multiForwardMsgElement) {
|
||||
} else if (element.multiForwardMsgElement) {
|
||||
message_data['type'] = OB11MessageDataType.forward;
|
||||
message_data['data']['id'] = msg.msgId;
|
||||
const ParentMsgPeer = msg.parentMsgPeer ?? { chatType: msg.chatType, guildId: '', peerUid: msg.peerUid };
|
||||
const ParentMsgPeer = msg.parentMsgPeer ?? {
|
||||
chatType: msg.chatType,
|
||||
guildId: '',
|
||||
peerUid: msg.peerUid,
|
||||
};
|
||||
//判断是否在合并消息内
|
||||
msg.parentMsgIdList = msg.parentMsgIdList ?? [];
|
||||
//首次列表不存在则开始创建
|
||||
@@ -340,7 +340,7 @@ export class OB11Constructor {
|
||||
MultiMsg.parentMsgPeer = ParentMsgPeer;
|
||||
MultiMsg.parentMsgIdList = msg.parentMsgIdList;
|
||||
MultiMsg.id = MessageUnique.createMsg(ParentMsgPeer, MultiMsg.msgId);//该ID仅用查看 无法调用
|
||||
const msgList = await OB11Constructor.message(coreContext, MultiMsg, "array");
|
||||
const msgList = await OB11Constructor.message(coreContext, MultiMsg, 'array');
|
||||
message_data['data']['content'].push(msgList);
|
||||
//console.log("合并消息", msgList);
|
||||
}
|
||||
@@ -350,8 +350,7 @@ export class OB11Constructor {
|
||||
|
||||
if (messagePostFormat === 'string') {
|
||||
(resMsg.message as string) += cqCode;
|
||||
}
|
||||
else (resMsg.message as OB11MessageData[]).push(message_data);
|
||||
} else (resMsg.message as OB11MessageData[]).push(message_data);
|
||||
resMsg.raw_message += cqCode;
|
||||
}
|
||||
|
||||
@@ -359,6 +358,7 @@ export class OB11Constructor {
|
||||
resMsg.raw_message = resMsg.raw_message.trim();
|
||||
return resMsg;
|
||||
}
|
||||
|
||||
static async PrivateEvent(coreContext: NapCatCore, msg: RawMessage): Promise<OB11BaseNoticeEvent | undefined> {
|
||||
const NTQQGroupApi = coreContext.getApiContext().GroupApi;
|
||||
const NTQQUserApi = coreContext.getApiContext().UserApi;
|
||||
@@ -396,7 +396,8 @@ export class OB11Constructor {
|
||||
}
|
||||
}
|
||||
}
|
||||
static async GroupEvent(coreContext:NapCatCore,msg: RawMessage): Promise<OB11GroupNoticeEvent | undefined> {
|
||||
|
||||
static async GroupEvent(coreContext: NapCatCore, msg: RawMessage): Promise<OB11GroupNoticeEvent | undefined> {
|
||||
const NTQQGroupApi = coreContext.getApiContext().GroupApi;
|
||||
const NTQQUserApi = coreContext.getApiContext().UserApi;
|
||||
const NTQQFileApi = coreContext.getApiContext().FileApi;
|
||||
@@ -440,8 +441,7 @@ export class OB11Constructor {
|
||||
// log("构造群增加事件", event)
|
||||
return event;
|
||||
}
|
||||
}
|
||||
else if (groupElement.type === TipGroupElementType.ban) {
|
||||
} else if (groupElement.type === TipGroupElementType.ban) {
|
||||
logger.logDebug('收到群群员禁言提示', groupElement);
|
||||
const memberUid = groupElement.shutUp!.member.uid;
|
||||
const adminUid = groupElement.shutUp!.admin.uid;
|
||||
@@ -451,8 +451,7 @@ export class OB11Constructor {
|
||||
// log('OB11被禁言事件', adminUid);
|
||||
if (memberUid) {
|
||||
memberUin = (await getGroupMember(msg.peerUid, memberUid))?.uin || ''; // || (await NTQQUserApi.getUserDetailInfo(memberUid))?.uin
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
memberUin = '0'; // 0表示全员禁言
|
||||
if (duration > 0) {
|
||||
duration = -1;
|
||||
@@ -464,8 +463,7 @@ export class OB11Constructor {
|
||||
const event = new OB11GroupBanEvent(parseInt(msg.peerUid), parseInt(memberUin), parseInt(adminUin), duration, sub_type);
|
||||
return event;
|
||||
}
|
||||
}
|
||||
else if (groupElement.type == TipGroupElementType.kicked) {
|
||||
} else if (groupElement.type == TipGroupElementType.kicked) {
|
||||
logger.logDebug(`收到我被踢出或退群提示, 群${msg.peerUid}`, groupElement);
|
||||
NTQQGroupApi.quitGroup(msg.peerUid).then();
|
||||
try {
|
||||
@@ -477,13 +475,12 @@ export class OB11Constructor {
|
||||
return new OB11GroupDecreaseEvent(parseInt(msg.peerUid), parseInt(coreContext.selfInfo.uin), 0, 'leave');
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (element.fileElement) {
|
||||
} else if (element.fileElement) {
|
||||
return new OB11GroupUploadNoticeEvent(parseInt(msg.peerUid), parseInt(msg.senderUin || ''), {
|
||||
id: element.fileElement.fileUuid!,
|
||||
name: element.fileElement.fileName,
|
||||
size: parseInt(element.fileElement.fileSize),
|
||||
busid: element.fileElement.fileBizId || 0
|
||||
busid: element.fileElement.fileBizId || 0,
|
||||
});
|
||||
}
|
||||
if (grayTipElement) {
|
||||
@@ -491,7 +488,7 @@ export class OB11Constructor {
|
||||
if (grayTipElement.xmlElement?.templId === '10382') {
|
||||
const emojiLikeData = new fastXmlParser.XMLParser({
|
||||
ignoreAttributes: false,
|
||||
attributeNamePrefix: ''
|
||||
attributeNamePrefix: '',
|
||||
}).parse(grayTipElement.xmlElement.content);
|
||||
logger.logDebug('收到表情回应我的消息', emojiLikeData);
|
||||
try {
|
||||
@@ -499,21 +496,25 @@ export class OB11Constructor {
|
||||
const msgSeq = emojiLikeData.gtip.url.msgseq;
|
||||
const emojiId = emojiLikeData.gtip.face.id;
|
||||
|
||||
const replyMsgList = (await NTQQMsgApi.getMsgsBySeqAndCount({ chatType: ChatType.group, guildId: '', peerUid: msg.peerUid }, msgSeq, 1, true, true)).msgList;
|
||||
const replyMsgList = (await NTQQMsgApi.getMsgsBySeqAndCount({
|
||||
chatType: ChatType.group,
|
||||
guildId: '',
|
||||
peerUid: msg.peerUid,
|
||||
}, msgSeq, 1, true, true)).msgList;
|
||||
if (replyMsgList.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const replyMsg = replyMsgList[0];
|
||||
console.log('表情回应消息', msgSeq, " 结算ID", replyMsg.msgId);
|
||||
console.log('表情回应消息', msgSeq, ' 结算ID', replyMsg.msgId);
|
||||
return new OB11GroupMsgEmojiLikeEvent(
|
||||
parseInt(msg.peerUid),
|
||||
parseInt(senderUin),
|
||||
MessageUnique.getShortIdByMsgId(replyMsg.msgId)!,
|
||||
[{
|
||||
emoji_id: emojiId,
|
||||
count: 1
|
||||
}]
|
||||
count: 1,
|
||||
}],
|
||||
);
|
||||
} catch (e: any) {
|
||||
logger.logError('解析表情回应消息失败', e.stack);
|
||||
@@ -559,7 +560,7 @@ export class OB11Constructor {
|
||||
const Peer: Peer = {
|
||||
guildId: '',
|
||||
chatType: ChatType.group,
|
||||
peerUid: Group!
|
||||
peerUid: Group!,
|
||||
};
|
||||
const msgData = await NTQQMsgApi.getMsgsBySeqAndCount(Peer, msgSeq.toString(), 1, true, true);
|
||||
return new OB11GroupEssenceEvent(parseInt(msg.peerUid), MessageUnique.getShortIdByMsgId(msgData.msgList[0].msgId)!, parseInt(msgData.msgList[0].senderUin));
|
||||
@@ -576,13 +577,14 @@ export class OB11Constructor {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static friend(friend: User): OB11User {
|
||||
return {
|
||||
user_id: parseInt(friend.uin),
|
||||
nickname: friend.nick,
|
||||
remark: friend.remark,
|
||||
sex: OB11Constructor.sex(friend.sex!),
|
||||
level: friend.qqLevel && calcQQLevel(friend.qqLevel) || 0
|
||||
level: friend.qqLevel && calcQQLevel(friend.qqLevel) || 0,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -592,6 +594,7 @@ export class OB11Constructor {
|
||||
nickname: selfInfo.nick,
|
||||
};
|
||||
}
|
||||
|
||||
static friendsV2(friends: FriendV2[]): OB11User[] {
|
||||
const data: OB11User[] = [];
|
||||
friends.forEach(friend => {
|
||||
@@ -605,16 +608,23 @@ export class OB11Constructor {
|
||||
sex: sexValue,
|
||||
level: 0,
|
||||
categroyName: friend.categroyName,
|
||||
categoryId: friend.categoryId
|
||||
categoryId: friend.categoryId,
|
||||
});
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
static friends(friends: Friend[]): OB11User[] {
|
||||
const data: OB11User[] = [];
|
||||
friends.forEach(friend => {
|
||||
const sexValue = this.sex(friend.sex!);
|
||||
data.push({ user_id: parseInt(friend.uin), nickname: friend.nick, remark: friend.remark, sex: sexValue, level: 0 });
|
||||
data.push({
|
||||
user_id: parseInt(friend.uin),
|
||||
nickname: friend.nick,
|
||||
remark: friend.remark,
|
||||
sex: sexValue,
|
||||
level: 0,
|
||||
});
|
||||
});
|
||||
return data;
|
||||
}
|
||||
@@ -623,7 +633,7 @@ export class OB11Constructor {
|
||||
return {
|
||||
4: OB11GroupMemberRole.owner,
|
||||
3: OB11GroupMemberRole.admin,
|
||||
2: OB11GroupMemberRole.member
|
||||
2: OB11GroupMemberRole.member,
|
||||
}[role];
|
||||
}
|
||||
|
||||
@@ -631,7 +641,7 @@ export class OB11Constructor {
|
||||
const sexMap = {
|
||||
[Sex.male]: OB11UserSex.male,
|
||||
[Sex.female]: OB11UserSex.female,
|
||||
[Sex.unknown]: OB11UserSex.unknown
|
||||
[Sex.unknown]: OB11UserSex.unknown,
|
||||
};
|
||||
return sexMap[sex] || OB11UserSex.unknown;
|
||||
}
|
||||
@@ -660,7 +670,7 @@ export class OB11Constructor {
|
||||
}
|
||||
|
||||
static stranger(user: User): OB11User {
|
||||
//logDebug('construct ob11 stranger', user);
|
||||
//logDebug('construct ob11 stranger', user);
|
||||
return {
|
||||
...user,
|
||||
user_id: parseInt(user.uin),
|
||||
@@ -679,7 +689,7 @@ export class OB11Constructor {
|
||||
group_id: parseInt(group.groupCode),
|
||||
group_name: group.groupName,
|
||||
member_count: group.memberCount,
|
||||
max_member_count: group.maxMember
|
||||
max_member_count: group.maxMember,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -7,94 +7,80 @@ const spColor = chalk.cyan;// for special
|
||||
|
||||
// todo: 应该放到core去用RawMessage解析打印
|
||||
export async function logMessage(coreContext: NapCatCore, ob11Message: OB11Message) {
|
||||
const isSelfSent = ob11Message.sender.user_id.toString() === coreContext.selfInfo.uin;
|
||||
let prefix = '';
|
||||
let group: Group | undefined;
|
||||
if (isSelfSent) {
|
||||
prefix = '发送消息 ';
|
||||
if (ob11Message.message_type === 'private') {
|
||||
prefix += '给私聊 ';
|
||||
prefix += `${ob11Message.target_id}`;
|
||||
const isSelfSent = ob11Message.sender.user_id.toString() === coreContext.selfInfo.uin;
|
||||
let prefix = '';
|
||||
let group: Group | undefined;
|
||||
if (isSelfSent) {
|
||||
prefix = '发送消息 ';
|
||||
if (ob11Message.message_type === 'private') {
|
||||
prefix += '给私聊 ';
|
||||
prefix += `${ob11Message.target_id}`;
|
||||
} else {
|
||||
prefix += '给群聊 ';
|
||||
}
|
||||
}
|
||||
else {
|
||||
prefix += '给群聊 ';
|
||||
if (ob11Message.message_type === 'group') {
|
||||
if (ob11Message.group_id == 284840486) {
|
||||
group = await getGroup(ob11Message.group_id!);
|
||||
prefix += '转发消息[外部来源] ';
|
||||
} else {
|
||||
group = await getGroup(ob11Message.group_id!);
|
||||
prefix += `群[${group?.groupName}(${ob11Message.group_id})] `;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ob11Message.message_type === 'group') {
|
||||
if (ob11Message.group_id == 284840486) {
|
||||
group = await getGroup(ob11Message.group_id!);
|
||||
prefix += '转发消息[外部来源] ';
|
||||
let msgChain = '';
|
||||
if (Array.isArray(ob11Message.message)) {
|
||||
const msgParts = [];
|
||||
for (const segment of ob11Message.message) {
|
||||
if (segment.type === 'text') {
|
||||
msgParts.push(segment.data.text);
|
||||
} else if (segment.type === 'at') {
|
||||
const groupMember = await getGroupMember(ob11Message.group_id!, segment.data.qq!);
|
||||
msgParts.push(spSegColor(`[@${groupMember?.cardName || groupMember?.nick}(${segment.data.qq})]`));
|
||||
} else if (segment.type === 'reply') {
|
||||
msgParts.push(spSegColor(`[回复消息|id:${segment.data.id}]`));
|
||||
} else if (segment.type === 'image') {
|
||||
msgParts.push(spSegColor(`[图片|${segment.data.url}]`));
|
||||
} else if (segment.type === 'face') {
|
||||
msgParts.push(spSegColor(`[表情|id:${segment.data.id}]`));
|
||||
} else if (segment.type === 'mface') {
|
||||
// @ts-expect-error 商城表情 url
|
||||
msgParts.push(spSegColor(`[商城表情|${segment.data.url}]`));
|
||||
} else if (segment.type === 'record') {
|
||||
msgParts.push(spSegColor(`[语音|${segment.data.file}]`));
|
||||
} else if (segment.type === 'file') {
|
||||
msgParts.push(spSegColor(`[文件|${segment.data.file}]`));
|
||||
} else if (segment.type === 'json') {
|
||||
msgParts.push(spSegColor(`[json|${JSON.stringify(segment.data)}]`));
|
||||
} else if (segment.type === 'markdown') {
|
||||
msgParts.push(spSegColor(`[markdown|${segment.data.content}]`));
|
||||
} else if (segment.type === 'video') {
|
||||
msgParts.push(spSegColor(`[视频|${segment.data.url}]`));
|
||||
} else if (segment.type === 'forward') {
|
||||
msgParts.push(spSegColor(`[转发|${segment.data.id}|消息开始]`));
|
||||
segment.data.content.forEach((msg) => {
|
||||
logMessage(coreContext, msg);
|
||||
});
|
||||
msgParts.push(spSegColor(`[转发|${segment.data.id}|消息结束]`));
|
||||
} else {
|
||||
msgParts.push(spSegColor(`[未实现|${JSON.stringify(segment)}]`));
|
||||
}
|
||||
}
|
||||
msgChain = msgParts.join(' ');
|
||||
} else {
|
||||
group = await getGroup(ob11Message.group_id!);
|
||||
prefix += `群[${group?.groupName}(${ob11Message.group_id})] `;
|
||||
msgChain = ob11Message.message;
|
||||
}
|
||||
}
|
||||
let msgChain = '';
|
||||
if (Array.isArray(ob11Message.message)) {
|
||||
const msgParts = [];
|
||||
for (const segment of ob11Message.message) {
|
||||
if (segment.type === 'text') {
|
||||
msgParts.push(segment.data.text);
|
||||
}
|
||||
else if (segment.type === 'at') {
|
||||
const groupMember = await getGroupMember(ob11Message.group_id!, segment.data.qq!);
|
||||
msgParts.push(spSegColor(`[@${groupMember?.cardName || groupMember?.nick}(${segment.data.qq})]`));
|
||||
}
|
||||
else if (segment.type === 'reply') {
|
||||
msgParts.push(spSegColor(`[回复消息|id:${segment.data.id}]`));
|
||||
}
|
||||
else if (segment.type === 'image') {
|
||||
msgParts.push(spSegColor(`[图片|${segment.data.url}]`));
|
||||
}
|
||||
else if (segment.type === 'face') {
|
||||
msgParts.push(spSegColor(`[表情|id:${segment.data.id}]`));
|
||||
}
|
||||
else if (segment.type === 'mface') {
|
||||
// @ts-expect-error 商城表情 url
|
||||
msgParts.push(spSegColor(`[商城表情|${segment.data.url}]`));
|
||||
}
|
||||
else if (segment.type === 'record') {
|
||||
msgParts.push(spSegColor(`[语音|${segment.data.file}]`));
|
||||
}
|
||||
else if (segment.type === 'file') {
|
||||
msgParts.push(spSegColor(`[文件|${segment.data.file}]`));
|
||||
}
|
||||
else if (segment.type === 'json') {
|
||||
msgParts.push(spSegColor(`[json|${JSON.stringify(segment.data)}]`));
|
||||
}
|
||||
else if (segment.type === 'markdown') {
|
||||
msgParts.push(spSegColor(`[markdown|${segment.data.content}]`));
|
||||
}
|
||||
else if (segment.type === 'video') {
|
||||
msgParts.push(spSegColor(`[视频|${segment.data.url}]`));
|
||||
}
|
||||
else if (segment.type === 'forward') {
|
||||
msgParts.push(spSegColor(`[转发|${segment.data.id}|消息开始]`));
|
||||
segment.data.content.forEach((msg) => {
|
||||
logMessage(coreContext, msg);
|
||||
});
|
||||
msgParts.push(spSegColor(`[转发|${segment.data.id}|消息结束]`));
|
||||
}
|
||||
else {
|
||||
msgParts.push(spSegColor(`[未实现|${JSON.stringify(segment)}]`));
|
||||
}
|
||||
let msgString = `${prefix}${ob11Message.sender.nickname}(${ob11Message.sender.user_id}): ${msgChain}`;
|
||||
if (isSelfSent) {
|
||||
msgString = `${prefix}: ${msgChain}`;
|
||||
}
|
||||
msgChain = msgParts.join(' ');
|
||||
}
|
||||
else {
|
||||
msgChain = ob11Message.message;
|
||||
}
|
||||
let msgString = `${prefix}${ob11Message.sender.nickname}(${ob11Message.sender.user_id}): ${msgChain}`;
|
||||
if (isSelfSent) {
|
||||
msgString = `${prefix}: ${msgChain}`;
|
||||
}
|
||||
coreContext.context.logger.log(msgString);
|
||||
coreContext.context.logger.log(msgString);
|
||||
}
|
||||
|
||||
export async function logNotice(coreContext: NapCatCore, ob11Notice: any) {
|
||||
coreContext.context.logger.log(spColor('[Notice]'), ob11Notice);
|
||||
coreContext.context.logger.log(spColor('[Notice]'), ob11Notice);
|
||||
}
|
||||
|
||||
export async function logRequest(coreContext: NapCatCore, ob11Request: any) {
|
||||
coreContext.context.logger.log(spColor('[Request]'), ob11Request);
|
||||
coreContext.context.logger.log(spColor('[Request]'), ob11Request);
|
||||
}
|
||||
|
||||
@@ -1,38 +1,43 @@
|
||||
import {
|
||||
AtType,
|
||||
ElementType, FaceIndex, FaceType, NapCatCore, PicElement,
|
||||
ElementType,
|
||||
FaceIndex,
|
||||
FaceType,
|
||||
NapCatCore,
|
||||
PicType,
|
||||
SendArkElement,
|
||||
SendFaceElement,
|
||||
SendFileElement, SendMarkdownElement, SendMarketFaceElement,
|
||||
SendFileElement,
|
||||
SendMarkdownElement,
|
||||
SendMarketFaceElement,
|
||||
SendPicElement,
|
||||
SendPttElement,
|
||||
SendReplyElement,
|
||||
sendShareLocationElement,
|
||||
SendTextElement,
|
||||
SendVideoElement,
|
||||
viedo_type
|
||||
viedo_type,
|
||||
} from '@/core';
|
||||
import { promises as fs } from 'node:fs';
|
||||
import ffmpeg from 'fluent-ffmpeg';
|
||||
import { NTQQFileApi } from '@/core/apis/file';
|
||||
import { calculateFileMD5, isGIF } from '@/common/utils/file';
|
||||
import { defaultVideoThumb, getVideoInfo } from '@/common/utils/video';
|
||||
import { encodeSilk } from '@/common/utils/audio';
|
||||
import { isNull } from '@/common/utils/helper';
|
||||
import faceConfig from '@/core/external/face_config.json';
|
||||
import * as pathLib from 'node:path';
|
||||
|
||||
export class SendMsgElementConstructor {
|
||||
static location(CoreContext: NapCatCore): sendShareLocationElement {
|
||||
return {
|
||||
elementType: ElementType.SHARELOCATION,
|
||||
elementId: '',
|
||||
shareLocationElement: {
|
||||
text: "测试",
|
||||
ext: ""
|
||||
}
|
||||
text: '测试',
|
||||
ext: '',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
static text(CoreContext: NapCatCore, content: string): SendTextElement {
|
||||
return {
|
||||
elementType: ElementType.TEXT,
|
||||
@@ -70,7 +75,7 @@ export class SendMsgElementConstructor {
|
||||
replayMsgId: msgId, // raw.msgId
|
||||
senderUin: senderUin,
|
||||
senderUinStr: senderUinStr,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -99,7 +104,7 @@ export class SendMsgElementConstructor {
|
||||
fileUuid: '',
|
||||
fileSubId: '',
|
||||
thumbFileSize: 0,
|
||||
summary
|
||||
summary,
|
||||
};
|
||||
//logDebug('图片信息', picElement);
|
||||
return {
|
||||
@@ -128,7 +133,7 @@ export class SendMsgElementConstructor {
|
||||
folderId: folderId,
|
||||
'filePath': path!,
|
||||
'fileSize': (fileSize).toString(),
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return element;
|
||||
@@ -153,7 +158,7 @@ export class SendMsgElementConstructor {
|
||||
time: 15,
|
||||
format: 'mp4',
|
||||
size: fileSize,
|
||||
filePath
|
||||
filePath,
|
||||
};
|
||||
try {
|
||||
videoInfo = await getVideoInfo(path, logger);
|
||||
@@ -183,7 +188,7 @@ export class SendMsgElementConstructor {
|
||||
timestamps: [0],
|
||||
filename: thumbFileName,
|
||||
folder: thumb,
|
||||
size: videoInfo.width + 'x' + videoInfo.height
|
||||
size: videoInfo.width + 'x' + videoInfo.height,
|
||||
}).on('end', () => {
|
||||
resolve(thumbPath);
|
||||
});
|
||||
@@ -219,7 +224,7 @@ export class SendMsgElementConstructor {
|
||||
// fileFormat: 2,
|
||||
// import_rich_media_context: null,
|
||||
// sourceVideoCodecFormat: 2
|
||||
}
|
||||
},
|
||||
};
|
||||
return element;
|
||||
}
|
||||
@@ -231,7 +236,11 @@ export class SendMsgElementConstructor {
|
||||
const NTQQMsgApi = coreContext.getApiContext().MsgApi;
|
||||
const NTQQFriendApi = coreContext.getApiContext().FriendApi;
|
||||
const logger = coreContext.context.logger;
|
||||
const { converted, path: silkPath, duration } = await encodeSilk(pttPath, coreContext.NapCatTempPath, coreContext.context.logger);
|
||||
const {
|
||||
converted,
|
||||
path: silkPath,
|
||||
duration,
|
||||
} = await encodeSilk(pttPath, coreContext.NapCatTempPath, coreContext.context.logger);
|
||||
// log("生成语音", silkPath, duration);
|
||||
if (!silkPath) {
|
||||
throw '语音转换失败, 请检查语音文件是否正常';
|
||||
@@ -263,9 +272,10 @@ export class SendMsgElementConstructor {
|
||||
fileSubId: '',
|
||||
playState: 1,
|
||||
autoConvertText: 0,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// NodeIQQNTWrapperSession sendMsg [
|
||||
// "0",
|
||||
// {
|
||||
@@ -289,7 +299,7 @@ export class SendMsgElementConstructor {
|
||||
// {}
|
||||
// ]
|
||||
static face(CoreContext: NapCatCore, faceId: number): SendFaceElement {
|
||||
// 从face_config.json中获取表情名称
|
||||
// 从face_config.json中获取表情名称
|
||||
const sysFaces = faceConfig.sysface;
|
||||
const emojiFaces = faceConfig.emoji;
|
||||
const face: any = sysFaces.find((face) => face.QSid === faceId.toString());
|
||||
@@ -330,7 +340,7 @@ export class SendMsgElementConstructor {
|
||||
}
|
||||
|
||||
static dice(CoreContext: NapCatCore, resultId: number | null): SendFaceElement {
|
||||
// 实际测试并不能控制结果
|
||||
// 实际测试并不能控制结果
|
||||
|
||||
// 随机1到6
|
||||
// if (isNull(resultId)) resultId = Math.floor(Math.random() * 6) + 1;
|
||||
@@ -348,14 +358,14 @@ export class SendMsgElementConstructor {
|
||||
// resultId: resultId.toString(),
|
||||
'surpriseId': '',
|
||||
// "randomType": 1,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// 猜拳(石头剪刀布)表情
|
||||
static rps(CoreContext: NapCatCore, resultId: number | null): SendFaceElement {
|
||||
// 实际测试并不能控制结果
|
||||
// if (isNull(resultId)) resultId = Math.floor(Math.random() * 3) + 1;
|
||||
// 实际测试并不能控制结果
|
||||
// if (isNull(resultId)) resultId = Math.floor(Math.random() * 3) + 1;
|
||||
return {
|
||||
elementType: ElementType.FACE,
|
||||
elementId: '',
|
||||
@@ -370,7 +380,7 @@ export class SendMsgElementConstructor {
|
||||
// 'resultId': resultId.toString(),
|
||||
'surpriseId': '',
|
||||
// "randomType": 1,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -384,8 +394,8 @@ export class SendMsgElementConstructor {
|
||||
arkElement: {
|
||||
bytesData: data,
|
||||
linkInfo: null,
|
||||
subElementType: null
|
||||
}
|
||||
subElementType: null,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -394,8 +404,8 @@ export class SendMsgElementConstructor {
|
||||
elementType: ElementType.MARKDOWN,
|
||||
elementId: '',
|
||||
markdownElement: {
|
||||
content
|
||||
}
|
||||
content,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
import { ChatType, Group, GroupRequestOperateTypes, NapCatCore, Peer } from "@/core";
|
||||
import { OB11FriendRequestEvent } from "../event/request/OB11FriendRequest";
|
||||
import { OB11GroupRequestEvent } from "../event/request/OB11GroupRequest";
|
||||
import { OB11Message, OB11MessageAt, OB11MessageData, OB11MessageReply, QuickAction, QuickActionEvent, QuickActionFriendRequest, QuickActionGroupMessage, QuickActionGroupRequest } from "../types";
|
||||
import { isNull } from "@/common/utils/helper";
|
||||
import { createSendElements, normalize, sendMsg } from "../action/msg/SendMsg";
|
||||
import { ChatType, Group, GroupRequestOperateTypes, NapCatCore, Peer } from '@/core';
|
||||
import { OB11FriendRequestEvent } from '../event/request/OB11FriendRequest';
|
||||
import { OB11GroupRequestEvent } from '../event/request/OB11GroupRequest';
|
||||
import {
|
||||
OB11Message,
|
||||
OB11MessageAt,
|
||||
OB11MessageData,
|
||||
OB11MessageReply,
|
||||
QuickAction,
|
||||
QuickActionEvent,
|
||||
QuickActionFriendRequest,
|
||||
QuickActionGroupMessage,
|
||||
QuickActionGroupRequest,
|
||||
} from '../types';
|
||||
import { isNull } from '@/common/utils/helper';
|
||||
import { createSendElements, normalize, sendMsg } from '../action/msg/SendMsg';
|
||||
|
||||
async function handleMsg(coreContext: NapCatCore, msg: OB11Message, quickAction: QuickAction) {
|
||||
msg = msg as OB11Message;
|
||||
const reply = quickAction.reply;
|
||||
const peer: Peer = {
|
||||
chatType: ChatType.friend,
|
||||
peerUid: await coreContext.getApiContext().UserApi.getUidByUin(msg.user_id.toString()) as string
|
||||
peerUid: await coreContext.getApiContext().UserApi.getUidByUin(msg.user_id.toString()) as string,
|
||||
};
|
||||
if (msg.message_type == 'private') {
|
||||
if (msg.sub_type === 'group') {
|
||||
@@ -29,15 +39,15 @@ async function handleMsg(coreContext: NapCatCore, msg: OB11Message, quickAction:
|
||||
replyMessage.push({
|
||||
type: 'reply',
|
||||
data: {
|
||||
id: msg.message_id.toString()
|
||||
}
|
||||
id: msg.message_id.toString(),
|
||||
},
|
||||
} as OB11MessageReply);
|
||||
if ((quickAction as QuickActionGroupMessage).at_sender) {
|
||||
replyMessage.push({
|
||||
type: 'at',
|
||||
data: {
|
||||
qq: msg.user_id.toString()
|
||||
}
|
||||
qq: msg.user_id.toString(),
|
||||
},
|
||||
} as OB11MessageAt);
|
||||
}
|
||||
}
|
||||
@@ -46,6 +56,7 @@ async function handleMsg(coreContext: NapCatCore, msg: OB11Message, quickAction:
|
||||
sendMsg(coreContext, peer, sendElements, deleteAfterSentFiles, false).then().catch(coreContext.context.logger.logError);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleGroupRequest(coreContext: NapCatCore, request: OB11GroupRequestEvent, quickAction: QuickActionGroupRequest) {
|
||||
if (!isNull(quickAction.approve)) {
|
||||
coreContext.getApiContext().GroupApi.handleGroupRequest(
|
||||
@@ -55,11 +66,13 @@ async function handleGroupRequest(coreContext: NapCatCore, request: OB11GroupReq
|
||||
).then().catch(coreContext.context.logger.logError);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleFriendRequest(coreContext: NapCatCore, request: OB11FriendRequestEvent, quickAction: QuickActionFriendRequest) {
|
||||
if (!isNull(quickAction.approve)) {
|
||||
coreContext.getApiContext().FriendApi.handleFriendRequest(request.flag, !!quickAction.approve).then().catch(coreContext.context.logger.logError);
|
||||
}
|
||||
}
|
||||
|
||||
export async function handleQuickOperation(coreContext: NapCatCore, context: QuickActionEvent, quickAction: QuickAction) {
|
||||
if (context.post_type === 'message') {
|
||||
handleMsg(coreContext, context as OB11Message, quickAction).then().catch(coreContext.context.logger.logError);
|
||||
@@ -69,9 +82,8 @@ export async function handleQuickOperation(coreContext: NapCatCore, context: Qui
|
||||
const groupRequest = context as OB11GroupRequestEvent;
|
||||
if ((friendRequest).request_type === 'friend') {
|
||||
handleFriendRequest(coreContext, friendRequest, quickAction).then().catch(coreContext.context.logger.logError);
|
||||
}
|
||||
else if (groupRequest.request_type === 'group') {
|
||||
} else if (groupRequest.request_type === 'group') {
|
||||
handleGroupRequest(coreContext, groupRequest, quickAction).then().catch(coreContext.context.logger.logError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user