mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
style: 标准化样式
This commit is contained in:
parent
136e27d655
commit
7b7609a068
@ -315,7 +315,7 @@ export class NTQQGroupApi {
|
|||||||
const sceneId = groupService.createMemberListScene(groupQQ, 'groupMemberList_MainWindow');
|
const sceneId = groupService.createMemberListScene(groupQQ, 'groupMemberList_MainWindow');
|
||||||
const result = await groupService.getNextMemberList(sceneId!, undefined, num);
|
const result = await groupService.getNextMemberList(sceneId!, undefined, num);
|
||||||
if (result.errCode !== 0) {
|
if (result.errCode !== 0) {
|
||||||
throw ('获取群成员列表出错,' + result.errMsg);
|
throw new Error('获取群成员列表出错,' + result.errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.context.logger.logDebug(`获取群(${groupQQ})成员列表结果:`, `members: ${result.result.infos.size}`); //, Array.from(result.result.infos.values()));
|
this.context.logger.logDebug(`获取群(${groupQQ})成员列表结果:`, `members: ${result.result.infos.size}`); //, Array.from(result.result.infos.values()));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { forceFetchClientKeyRetType } from './common';
|
import { ForceFetchClientKeyRetType } from './common';
|
||||||
|
|
||||||
export interface NodeIKernelTicketService {
|
export interface NodeIKernelTicketService {
|
||||||
|
|
||||||
@ -6,7 +6,7 @@ export interface NodeIKernelTicketService {
|
|||||||
|
|
||||||
removeKernelTicketListener(listenerId: unknown): void;
|
removeKernelTicketListener(listenerId: unknown): void;
|
||||||
|
|
||||||
forceFetchClientKey(arg: string): Promise<forceFetchClientKeyRetType>;
|
forceFetchClientKey(arg: string): Promise<ForceFetchClientKeyRetType>;
|
||||||
|
|
||||||
isNull(): boolean;
|
isNull(): boolean;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ export interface GeneralCallResult {
|
|||||||
errMsg: string
|
errMsg: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface forceFetchClientKeyRetType extends GeneralCallResult {
|
export interface ForceFetchClientKeyRetType extends GeneralCallResult {
|
||||||
url: string;
|
url: string;
|
||||||
keyIndex: string;
|
keyIndex: string;
|
||||||
clientKey: string;
|
clientKey: string;
|
||||||
|
@ -26,12 +26,12 @@ class GetGroupMemberInfo extends BaseAction<Payload, OB11GroupMember> {
|
|||||||
const NTQQGroupApi = this.CoreContext.apis.GroupApi;
|
const NTQQGroupApi = this.CoreContext.apis.GroupApi;
|
||||||
const isNocache = typeof payload.no_cache === 'string' ? payload.no_cache === 'true' : !!payload.no_cache;
|
const isNocache = typeof payload.no_cache === 'string' ? payload.no_cache === 'true' : !!payload.no_cache;
|
||||||
const uid = await NTQQUserApi.getUidByUinV2(payload.user_id.toString());
|
const uid = await NTQQUserApi.getUidByUinV2(payload.user_id.toString());
|
||||||
if (!uid) throw (`Uin2Uid Error ${payload.user_id}不存在`);
|
if (!uid) throw new Error (`Uin2Uid Error ${payload.user_id}不存在`);
|
||||||
const [member, info] = await Promise.allSettled([
|
const [member, info] = await Promise.allSettled([
|
||||||
NTQQGroupApi.getGroupMemberV2(payload.group_id.toString(), uid, isNocache),
|
NTQQGroupApi.getGroupMemberV2(payload.group_id.toString(), uid, isNocache),
|
||||||
NTQQUserApi.getUserDetailInfo(uid),
|
NTQQUserApi.getUserDetailInfo(uid),
|
||||||
]);
|
]);
|
||||||
if (member.status !== 'fulfilled') throw (`群(${payload.group_id})成员${payload.user_id}不存在 ${member.reason}`);
|
if (member.status !== 'fulfilled') throw new Error (`群(${payload.group_id})成员${payload.user_id}不存在 ${member.reason}`);
|
||||||
if (info.status === 'fulfilled') {
|
if (info.status === 'fulfilled') {
|
||||||
this.CoreContext.context.logger.logDebug("群成员详细信息结果", info.value);
|
this.CoreContext.context.logger.logDebug("群成员详细信息结果", info.value);
|
||||||
Object.assign(member, info.value);
|
Object.assign(member, info.value);
|
||||||
|
@ -30,7 +30,7 @@ class GetMsg extends BaseAction<Payload, OB11Message> {
|
|||||||
const MsgShortId = MessageUnique.getShortIdByMsgId(payload.message_id.toString());
|
const MsgShortId = MessageUnique.getShortIdByMsgId(payload.message_id.toString());
|
||||||
const msgIdWithPeer = MessageUnique.getMsgIdAndPeerByShortId(MsgShortId || parseInt(payload.message_id.toString()));
|
const msgIdWithPeer = MessageUnique.getMsgIdAndPeerByShortId(MsgShortId || parseInt(payload.message_id.toString()));
|
||||||
if (!msgIdWithPeer) {
|
if (!msgIdWithPeer) {
|
||||||
throw ('消息不存在');
|
throw new Error('消息不存在');
|
||||||
}
|
}
|
||||||
const peer = { guildId: '', peerUid: msgIdWithPeer?.Peer.peerUid, chatType: msgIdWithPeer.Peer.chatType };
|
const peer = { guildId: '', peerUid: msgIdWithPeer?.Peer.peerUid, chatType: msgIdWithPeer.Peer.chatType };
|
||||||
const msg = await NTQQMsgApi.getMsgsByMsgId(
|
const msg = await NTQQMsgApi.getMsgsByMsgId(
|
||||||
|
@ -36,7 +36,7 @@ class MarkMsgAsRead extends BaseAction<PlayloadType, null> {
|
|||||||
// 调用API
|
// 调用API
|
||||||
const ret = await NTQQMsgApi.setMsgRead(await this.getPeer(payload));
|
const ret = await NTQQMsgApi.setMsgRead(await this.getPeer(payload));
|
||||||
if (ret.result != 0) {
|
if (ret.result != 0) {
|
||||||
throw ('设置已读失败,' + ret.errMsg);
|
throw new Error('设置已读失败,' + ret.errMsg);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ export async function sendMsg(coreContext: NapCatCore, peer: Peer, sendElements:
|
|||||||
const NTQQMsgApi = coreContext.apis.MsgApi;
|
const NTQQMsgApi = coreContext.apis.MsgApi;
|
||||||
const logger = coreContext.context.logger;
|
const logger = coreContext.context.logger;
|
||||||
if (!sendElements.length) {
|
if (!sendElements.length) {
|
||||||
throw ('消息体无法解析, 请检查是否发送了不支持的消息类型');
|
throw new Error ('消息体无法解析, 请检查是否发送了不支持的消息类型');
|
||||||
}
|
}
|
||||||
let totalSize = 0;
|
let totalSize = 0;
|
||||||
let timeout = 10000;
|
let timeout = 10000;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user