mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: add missing catch
es
This commit is contained in:
@@ -104,8 +104,7 @@ export class NapCatOneBot11Adapter {
|
|||||||
this.initBuddyListener();
|
this.initBuddyListener();
|
||||||
this.initGroupListener();
|
this.initGroupListener();
|
||||||
|
|
||||||
// 未对shell版本兼容
|
// TODO: 兼容 Shell - MliKiowa
|
||||||
// Mlikiowa V2.0.0 Refactor Todo
|
|
||||||
await WebUiDataRuntime.setQQLoginUin(selfInfo.uin.toString());
|
await WebUiDataRuntime.setQQLoginUin(selfInfo.uin.toString());
|
||||||
await WebUiDataRuntime.setQQLoginStatus(true);
|
await WebUiDataRuntime.setQQLoginStatus(true);
|
||||||
await WebUiDataRuntime.setOB11ConfigCall(async (ob11: OB11Config) => {
|
await WebUiDataRuntime.setOB11ConfigCall(async (ob11: OB11Config) => {
|
||||||
@@ -148,7 +147,8 @@ export class NapCatOneBot11Adapter {
|
|||||||
};
|
};
|
||||||
|
|
||||||
msgListener.onMsgInfoListUpdate = async msgList => {
|
msgListener.onMsgInfoListUpdate = async msgList => {
|
||||||
this.emitRecallMsg(msgList);
|
this.emitRecallMsg(msgList)
|
||||||
|
.catch(e => this.context.logger.logError('处理消息失败', e));
|
||||||
for (const msg of msgList.filter(e => e.senderUin == this.core.selfInfo.uin)) {
|
for (const msg of msgList.filter(e => e.senderUin == this.core.selfInfo.uin)) {
|
||||||
// console.log(msg);
|
// console.log(msg);
|
||||||
if (msg.sendStatus == 2) {
|
if (msg.sendStatus == 2) {
|
||||||
@@ -245,13 +245,13 @@ export class NapCatOneBot11Adapter {
|
|||||||
parseInt(member1.uin),
|
parseInt(member1.uin),
|
||||||
[GroupNotifyTypes.ADMIN_UNSET, GroupNotifyTypes.ADMIN_UNSET_OTHER].includes(notify.type) ? 'unset' : 'set'
|
[GroupNotifyTypes.ADMIN_UNSET, GroupNotifyTypes.ADMIN_UNSET_OTHER].includes(notify.type) ? 'unset' : 'set'
|
||||||
);
|
);
|
||||||
this.networkManager.emitEvent(groupAdminNoticeEvent);
|
this.networkManager.emitEvent(groupAdminNoticeEvent)
|
||||||
|
.catch(e => this.context.logger.logError('处理群管理员变动失败', e));
|
||||||
} else {
|
} else {
|
||||||
this.context.logger.logDebug('获取群通知的成员信息失败', notify, this.core.ApiContext.GroupApi.getGroup(notify.group.groupCode));
|
this.context.logger.logDebug('获取群通知的成员信息失败', notify, this.core.ApiContext.GroupApi.getGroup(notify.group.groupCode));
|
||||||
}
|
}
|
||||||
} else if (notify.type == GroupNotifyTypes.MEMBER_EXIT || notify.type == GroupNotifyTypes.KICK_MEMBER) {
|
} else if (notify.type == GroupNotifyTypes.MEMBER_EXIT || notify.type == GroupNotifyTypes.KICK_MEMBER) {
|
||||||
this.context.logger.logDebug('有成员退出通知', notify);
|
this.context.logger.logDebug('有成员退出通知', notify);
|
||||||
try {
|
|
||||||
const member1Uin = (await this.core.ApiContext.UserApi.getUinByUidV2(notify.user1.uid))!;
|
const member1Uin = (await this.core.ApiContext.UserApi.getUinByUidV2(notify.user1.uid))!;
|
||||||
let operatorId = member1Uin;
|
let operatorId = member1Uin;
|
||||||
let subType: GroupDecreaseSubType = 'leave';
|
let subType: GroupDecreaseSubType = 'leave';
|
||||||
@@ -270,10 +270,8 @@ export class NapCatOneBot11Adapter {
|
|||||||
parseInt(operatorId),
|
parseInt(operatorId),
|
||||||
subType
|
subType
|
||||||
);
|
);
|
||||||
this.networkManager.emitEvent(groupDecreaseEvent);
|
this.networkManager.emitEvent(groupDecreaseEvent)
|
||||||
} catch (e: any) {
|
.catch(e => this.context.logger.logError('处理群成员退出失败', e));
|
||||||
this.context.logger.logError('获取群通知的成员信息失败', notify, e.stack.toString());
|
|
||||||
}
|
|
||||||
// notify.status == 1 表示未处理 2表示处理完成
|
// notify.status == 1 表示未处理 2表示处理完成
|
||||||
} else if ([
|
} else if ([
|
||||||
GroupNotifyTypes.JOIN_REQUEST
|
GroupNotifyTypes.JOIN_REQUEST
|
||||||
@@ -292,7 +290,8 @@ export class NapCatOneBot11Adapter {
|
|||||||
notify.postscript,
|
notify.postscript,
|
||||||
flag
|
flag
|
||||||
);
|
);
|
||||||
this.networkManager.emitEvent(groupRequestEvent);
|
this.networkManager.emitEvent(groupRequestEvent)
|
||||||
|
.catch(e => this.context.logger.logError('处理加群请求失败', e));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.context.logger.logError('获取加群人QQ号失败 Uid:', notify.user1.uid, e);
|
this.context.logger.logError('获取加群人QQ号失败 Uid:', notify.user1.uid, e);
|
||||||
}
|
}
|
||||||
@@ -306,7 +305,8 @@ export class NapCatOneBot11Adapter {
|
|||||||
notify.postscript,
|
notify.postscript,
|
||||||
flag
|
flag
|
||||||
);
|
);
|
||||||
this.networkManager.emitEvent(groupInviteEvent);
|
this.networkManager.emitEvent(groupInviteEvent)
|
||||||
|
.catch(e => this.context.logger.logError('处理邀请本人加群失败', e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -361,7 +361,7 @@ export class NapCatOneBot11Adapter {
|
|||||||
// log("message update", message.sendStatus, message.msgId, message.msgSeq)
|
// log("message update", message.sendStatus, message.msgId, message.msgSeq)
|
||||||
if (message.recallTime != '0') { //todo: 这个判断方法不太好,应该使用灰色消息元素来判断?
|
if (message.recallTime != '0') { //todo: 这个判断方法不太好,应该使用灰色消息元素来判断?
|
||||||
// 撤回消息上报
|
// 撤回消息上报
|
||||||
const oriMessageId = await MessageUnique.getShortIdByMsgId(message.msgId);
|
const oriMessageId = MessageUnique.getShortIdByMsgId(message.msgId);
|
||||||
if (!oriMessageId) {
|
if (!oriMessageId) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -371,7 +371,8 @@ export class NapCatOneBot11Adapter {
|
|||||||
parseInt(message!.senderUin),
|
parseInt(message!.senderUin),
|
||||||
oriMessageId
|
oriMessageId
|
||||||
);
|
);
|
||||||
this.networkManager.emitEvent(friendRecallEvent);
|
this.networkManager.emitEvent(friendRecallEvent)
|
||||||
|
.catch(e => this.context.logger.logError('处理好友消息撤回失败', e));
|
||||||
} else if (message.chatType == ChatType.group) {
|
} else if (message.chatType == ChatType.group) {
|
||||||
let operatorId = message.senderUin;
|
let operatorId = message.senderUin;
|
||||||
for (const element of message.elements) {
|
for (const element of message.elements) {
|
||||||
@@ -386,7 +387,8 @@ export class NapCatOneBot11Adapter {
|
|||||||
parseInt(operatorId),
|
parseInt(operatorId),
|
||||||
oriMessageId
|
oriMessageId
|
||||||
);
|
);
|
||||||
this.networkManager.emitEvent(groupRecallEvent);
|
this.networkManager.emitEvent(groupRecallEvent)
|
||||||
|
.catch(e => this.context.logger.logError('处理群消息撤回失败', e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user