mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-13 00:10:27 +00:00
chore: reformat code style
This commit is contained in:
@@ -11,6 +11,7 @@ export class OneBotFriendApi {
|
||||
this.obContext = obContext;
|
||||
this.core = core;
|
||||
}
|
||||
|
||||
//使用前预先判断 busiId 1061
|
||||
async parsePrivatePokeEvent(grayTipElement: GrayTipElement) {
|
||||
const NTQQUserApi = this.core.apis.UserApi;
|
||||
@@ -24,7 +25,7 @@ export class OneBotFriendApi {
|
||||
this.core,
|
||||
parseInt((await NTQQUserApi.getUinByUidV2(pokedetail[0].uid))!),
|
||||
parseInt((await NTQQUserApi.getUinByUidV2(pokedetail[1].uid))!),
|
||||
pokedetail
|
||||
pokedetail,
|
||||
);
|
||||
}
|
||||
return undefined;
|
||||
|
||||
@@ -15,6 +15,7 @@ export class OneBotGroupApi {
|
||||
this.obContext = obContext;
|
||||
this.core = core;
|
||||
}
|
||||
|
||||
async parseGroupBanEvent(GroupCode: string, grayTipElement: GrayTipElement) {
|
||||
const groupElement = grayTipElement?.groupElement;
|
||||
const NTQQGroupApi = this.core.apis.GroupApi;
|
||||
@@ -40,11 +41,12 @@ export class OneBotGroupApi {
|
||||
parseInt(memberUin),
|
||||
parseInt(adminUin),
|
||||
duration,
|
||||
subType
|
||||
subType,
|
||||
);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async parseGroupIncreaseEvent(GroupCode: string, grayTipElement: GrayTipElement) {
|
||||
this.core.context.logger.logDebug('收到新人被邀请进群消息', grayTipElement);
|
||||
const xmlElement = grayTipElement.xmlElement;
|
||||
@@ -65,12 +67,13 @@ export class OneBotGroupApi {
|
||||
parseInt(GroupCode),
|
||||
parseInt(invitee),
|
||||
parseInt(inviter),
|
||||
'invite'
|
||||
'invite',
|
||||
);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async parseGroupMemberIncreaseEvent(GroupCode: string, grayTipElement: GrayTipElement) {
|
||||
const NTQQGroupApi = this.core.apis.GroupApi;
|
||||
const groupElement = grayTipElement?.groupElement;
|
||||
@@ -84,11 +87,12 @@ export class OneBotGroupApi {
|
||||
this.core,
|
||||
parseInt(GroupCode),
|
||||
parseInt(memberUin),
|
||||
parseInt(operatorUin)
|
||||
parseInt(operatorUin),
|
||||
);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async parseGroupKickEvent(GroupCode: string, grayTipElement: GrayTipElement) {
|
||||
const NTQQGroupApi = this.core.apis.GroupApi;
|
||||
const NTQQUserApi = this.core.apis.UserApi;
|
||||
@@ -101,11 +105,12 @@ export class OneBotGroupApi {
|
||||
parseInt(GroupCode),
|
||||
parseInt(this.core.selfInfo.uin),
|
||||
parseInt(adminUin),
|
||||
'kick_me'
|
||||
'kick_me',
|
||||
);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async parseGroupEmjioLikeEvent(GroupCode: string, grayTipElement: GrayTipElement) {
|
||||
const NTQQMsgApi = this.core.apis.MsgApi;
|
||||
const emojiLikeData = new fastXmlParser.XMLParser({
|
||||
@@ -120,7 +125,7 @@ export class OneBotGroupApi {
|
||||
const peer = {
|
||||
chatType: ChatType.KCHATTYPEGROUP,
|
||||
guildId: '',
|
||||
peerUid: GroupCode
|
||||
peerUid: GroupCode,
|
||||
};
|
||||
const replyMsgList = (await NTQQMsgApi.getMsgExBySeq(peer, msgSeq)).msgList;
|
||||
if (replyMsgList.length < 1) {
|
||||
|
||||
@@ -36,7 +36,7 @@ type RawToOb11Converters = {
|
||||
[Key in keyof MessageElement as Key extends `${string}Element` ? Key : never]: (
|
||||
element: Exclude<MessageElement[Key], null | undefined>,
|
||||
msg: RawMessage,
|
||||
elementWrapper: MessageElement
|
||||
elementWrapper: MessageElement,
|
||||
) => PromiseLike<OB11MessageData | null>
|
||||
}
|
||||
|
||||
@@ -73,12 +73,12 @@ export class OneBotMsgApi {
|
||||
}
|
||||
return {
|
||||
type: OB11MessageDataType.text,
|
||||
data: { text }
|
||||
data: { text },
|
||||
};
|
||||
} else {
|
||||
let qq: string = 'all';
|
||||
if (element.atType !== AtType.atAll) {
|
||||
const { atNtUid, /* content */ } = element;
|
||||
const { atNtUid /* content */ } = element;
|
||||
let atQQ = element.atUid;
|
||||
if (!atQQ || atQQ === '0') {
|
||||
atQQ = await this.core.apis.UserApi.getUinByUidV2(atNtUid);
|
||||
@@ -138,7 +138,7 @@ export class OneBotMsgApi {
|
||||
url: element.filePath,
|
||||
file_id: UUIDConverter.encode(msg.peerUin, msg.msgId),
|
||||
file_size: element.fileSize,
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -149,21 +149,21 @@ export class OneBotMsgApi {
|
||||
type: OB11MessageDataType.dice,
|
||||
data: {
|
||||
result: element.resultId!,
|
||||
}
|
||||
},
|
||||
};
|
||||
} else if (faceIndex === FaceIndex.RPS) {
|
||||
return {
|
||||
type: OB11MessageDataType.RPS,
|
||||
data: {
|
||||
result: element.resultId!,
|
||||
}
|
||||
},
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: OB11MessageDataType.face,
|
||||
data: {
|
||||
id: element.faceIndex.toString()
|
||||
}
|
||||
id: element.faceIndex.toString(),
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
@@ -190,7 +190,7 @@ export class OneBotMsgApi {
|
||||
file_id: UUIDConverter.encode(msg.peerUin, msg.msgId),
|
||||
path: elementWrapper.elementId,
|
||||
url: elementWrapper.elementId,
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -239,8 +239,8 @@ export class OneBotMsgApi {
|
||||
peerUid: msg.peerUid,
|
||||
guildId: '',
|
||||
chatType: msg.chatType,
|
||||
}, replyMsg.msgId).toString()
|
||||
}
|
||||
}, replyMsg.msgId).toString(),
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -303,7 +303,7 @@ export class OneBotMsgApi {
|
||||
url: videoDownUrl,
|
||||
file_id: UUIDConverter.encode(msg.peerUin, msg.msgId),
|
||||
file_size: element.fileSize,
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -329,7 +329,7 @@ export class OneBotMsgApi {
|
||||
path: element.filePath,
|
||||
file_id: UUIDConverter.encode(msg.peerUin, msg.msgId),
|
||||
file_size: element.fileSize,
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -366,9 +366,9 @@ export class OneBotMsgApi {
|
||||
multiMsgItem.parentMsgIdList = msg.parentMsgIdList;
|
||||
multiMsgItem.id = MessageUnique.createMsg(parentMsgPeer, multiMsgItem.msgId); //该ID仅用查看 无法调用
|
||||
return await this.parseMessage(multiMsgItem);
|
||||
}
|
||||
},
|
||||
))).filter(item => item !== undefined),
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -376,8 +376,8 @@ export class OneBotMsgApi {
|
||||
return {
|
||||
type: OB11MessageDataType.json,
|
||||
data: {
|
||||
data: element.bytesData
|
||||
}
|
||||
data: element.bytesData,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -385,10 +385,10 @@ export class OneBotMsgApi {
|
||||
return {
|
||||
type: OB11MessageDataType.markdown,
|
||||
data: {
|
||||
content: element.content
|
||||
}
|
||||
content: element.content,
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
ob11ToRawConverters: Ob11ToRawConverters = {
|
||||
@@ -716,11 +716,11 @@ export class OneBotMsgApi {
|
||||
// @ts-ignore
|
||||
element[key],
|
||||
msg,
|
||||
element
|
||||
element,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
))).filter(entry => {
|
||||
if (entry.status === 'fulfilled') {
|
||||
return !!entry.value;
|
||||
@@ -822,7 +822,7 @@ export class OneBotMsgApi {
|
||||
this.core.context.logger.logError('文件消息缺少参数', inputdata);
|
||||
throw Error('文件消息缺少参数');
|
||||
}
|
||||
const fileOrUrl = (isBlankUrl ? inputdata.file : inputdata.url) ?? "";
|
||||
const fileOrUrl = (isBlankUrl ? inputdata.file : inputdata.url) ?? '';
|
||||
const {
|
||||
path,
|
||||
isLocal,
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import {
|
||||
NapCatOneBot11Adapter,
|
||||
OB11Message, OB11MessageAt,
|
||||
OB11Message,
|
||||
OB11MessageAt,
|
||||
OB11MessageData,
|
||||
OB11MessageReply,
|
||||
QuickAction,
|
||||
QuickActionEvent, QuickActionFriendRequest, QuickActionGroupMessage, QuickActionGroupRequest,
|
||||
QuickActionEvent,
|
||||
QuickActionFriendRequest,
|
||||
QuickActionGroupMessage,
|
||||
QuickActionGroupRequest,
|
||||
} from '@/onebot';
|
||||
import { ChatType, GroupRequestOperateTypes, NapCatCore, Peer } from '@/core';
|
||||
import { OB11FriendRequestEvent } from '@/onebot/event/request/OB11FriendRequest';
|
||||
@@ -15,8 +19,9 @@ import { isNull } from '@/common/utils/helper';
|
||||
export class OneBotQuickActionApi {
|
||||
constructor(
|
||||
public obContext: NapCatOneBot11Adapter,
|
||||
public core: NapCatCore
|
||||
) {}
|
||||
public core: NapCatCore,
|
||||
) {
|
||||
}
|
||||
|
||||
async handleQuickOperation(eventContext: QuickActionEvent, quickAction: QuickAction) {
|
||||
if (eventContext.post_type === 'message') {
|
||||
@@ -72,7 +77,10 @@ export class OneBotQuickActionApi {
|
||||
}
|
||||
}
|
||||
replyMessage = replyMessage.concat(normalize(reply, quickAction.auto_escape));
|
||||
const { sendElements, deleteAfterSentFiles } = await this.obContext.apis.MsgApi.createSendElements(replyMessage, peer);
|
||||
const {
|
||||
sendElements,
|
||||
deleteAfterSentFiles,
|
||||
} = await this.obContext.apis.MsgApi.createSendElements(replyMessage, peer);
|
||||
this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(peer, sendElements, deleteAfterSentFiles, false).then().catch(this.core.context.logger.logError);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user