style: lint

This commit is contained in:
手瓜一十雪
2025-01-13 20:30:57 +08:00
parent ec0c2e8c33
commit 7c8cbc0799
7 changed files with 37 additions and 37 deletions

View File

@@ -20,7 +20,7 @@ export class Fallback<T> {
for (const handler of this.handlers) {
try {
const result = await handler();
let data = await this.checker(result);
const data = await this.checker(result);
if (data) {
return data;
}

View File

@@ -28,7 +28,7 @@ class GetGroupMemberInfo extends OneBotAction<Payload, OB11GroupMember> {
private async getGroupMemberInfo(payload: Payload, uid: string, isNocache: boolean) {
const groupMemberCache = this.core.apis.GroupApi.groupMemberCache.get(payload.group_id.toString());
let groupMember = groupMemberCache?.get(uid);
const groupMember = groupMemberCache?.get(uid);
const [member, info] = await Promise.all([
this.core.apis.GroupApi.getGroupMemberEx(payload.group_id.toString(), uid, isNocache),

View File

@@ -19,7 +19,7 @@ export default class SetGroupAddRequest extends OneBotAction<Payload, null> {
const flag = payload.flag.toString();
const approve = payload.approve?.toString() !== 'false';
const reason = payload.reason ?? ' ';
let invite_notify = this.obContext.apis.MsgApi.notifyGroupInvite.get(flag);
const invite_notify = this.obContext.apis.MsgApi.notifyGroupInvite.get(flag);
const notify = invite_notify ?? await this.findNotify(flag);
if (!notify) {
throw new Error('No such request');

View File

@@ -218,7 +218,7 @@ export class OneBotGroupApi {
element.groupName,
);
} else if (element.type === TipGroupElementType.KSHUTUP) {
let event = await this.parseGroupBanEvent(msg.peerUid, elementWrapper);
const event = await this.parseGroupBanEvent(msg.peerUid, elementWrapper);
return event;
} else if (element.type === TipGroupElementType.KMEMBERADD) {
// 自己的通知 协议推送为type->85 在这里实现为了避免邀请出现问题

View File

@@ -206,7 +206,7 @@ export class OneBotMsgApi {
const dir = emojiId.substring(0, 2);
const url = `https://gxh.vip.qq.com/club/item/parcel/item/${dir}/${emojiId}/raw300.gif`;
const filename = `${dir}-${emojiId}.gif`;
FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId, "", filename)
FileNapCatOneBotUUID.encode(peer, msg.msgId, elementWrapper.elementId, "", filename);
return {
type: OB11MessageDataType.image,
data: {
@@ -798,7 +798,7 @@ export class OneBotMsgApi {
private async handlePrivateMessage(resMsg: OB11Message, msg: RawMessage) {
resMsg.sub_type = 'friend';
if (await this.core.apis.FriendApi.isBuddy(msg.senderUid)) {
let nickname = (await this.core.apis.UserApi.getCoreAndBaseInfo([msg.senderUid])).get(msg.senderUid)?.coreInfo.nick;
const nickname = (await this.core.apis.UserApi.getCoreAndBaseInfo([msg.senderUid])).get(msg.senderUid)?.coreInfo.nick;
if (nickname) {
resMsg.sender.nickname = nickname;
return;
@@ -994,8 +994,8 @@ export class OneBotMsgApi {
}
async waitGroupNotify(groupUin: string, memberUid?: string, operatorUid?: string) {
let groupRole = this.core.apis.GroupApi.groupMemberCache.get(groupUin)?.get(this.core.selfInfo.uid.toString())?.role;
let isAdminOrOwner = groupRole === 3 || groupRole === 4;
const groupRole = this.core.apis.GroupApi.groupMemberCache.get(groupUin)?.get(this.core.selfInfo.uid.toString())?.role;
const isAdminOrOwner = groupRole === 3 || groupRole === 4;
if (isAdminOrOwner && !operatorUid) {
let dataNotify: GroupNotify | undefined;
@@ -1023,7 +1023,7 @@ export class OneBotMsgApi {
if (SysMessage.contentHead.type == 33 && SysMessage.body?.msgContent) {
const groupChange = new NapProtoMsg(GroupChange).decode(SysMessage.body.msgContent);
await this.core.apis.GroupApi.refreshGroupMemberCache(groupChange.groupUin.toString(), true);
let operatorUid = await this.waitGroupNotify(
const operatorUid = await this.waitGroupNotify(
groupChange.groupUin.toString(),
groupChange.memberUid,
groupChange.operatorInfo ? Buffer.from(groupChange.operatorInfo).toString() : ''
@@ -1039,7 +1039,7 @@ export class OneBotMsgApi {
} else if (SysMessage.contentHead.type == 34 && SysMessage.body?.msgContent) {
const groupChange = new NapProtoMsg(GroupChange).decode(SysMessage.body.msgContent);
// 自身被踢出时operatorInfo会是一个protobuf 否则大多数情况为一个string
let operatorUid = await this.waitGroupNotify(
const operatorUid = await this.waitGroupNotify(
groupChange.groupUin.toString(),
groupChange.memberUid,
groupChange.decreaseType === 3 && groupChange.operatorInfo ?
@@ -1080,17 +1080,17 @@ export class OneBotMsgApi {
enabled ? 'set' : 'unset'
);
} else if (SysMessage.contentHead.type == 87 && SysMessage.body?.msgContent) {
let groupInvite = new NapProtoMsg(GroupInvite).decode(SysMessage.body.msgContent);
const groupInvite = new NapProtoMsg(GroupInvite).decode(SysMessage.body.msgContent);
let request_seq = '';
try {
await this.core.eventWrapper.registerListen('NodeIKernelMsgListener/onRecvMsg', (msgs) => {
for (const msg of msgs) {
if (msg.senderUid === groupInvite.invitorUid && msg.msgType === 11) {
let jumpUrl = JSON.parse(msg.elements.find(e => e.elementType === 10)?.arkElement?.bytesData ?? '').meta?.news?.jumpUrl;
let jumpUrlParams = new URLSearchParams(jumpUrl);
let groupcode = jumpUrlParams.get('groupcode');
let receiveruin = jumpUrlParams.get('receiveruin');
let msgseq = jumpUrlParams.get('msgseq');
const jumpUrl = JSON.parse(msg.elements.find(e => e.elementType === 10)?.arkElement?.bytesData ?? '').meta?.news?.jumpUrl;
const jumpUrlParams = new URLSearchParams(jumpUrl);
const groupcode = jumpUrlParams.get('groupcode');
const receiveruin = jumpUrlParams.get('receiveruin');
const msgseq = jumpUrlParams.get('msgseq');
request_seq = msgseq ?? '';
if (groupcode === groupInvite.groupUin.toString() && receiveruin === this.core.selfInfo.uin) {
return true;
@@ -1136,7 +1136,7 @@ export class OneBotMsgApi {
waitStatus: 1,
},
status: 1
})
});
return new OB11GroupRequestEvent(
this.core,
+groupInvite.groupUin,

View File

@@ -92,7 +92,7 @@ export class OneBotQuickActionApi {
async handleGroupRequest(request: OB11GroupRequestEvent, quickAction: QuickActionGroupRequest) {
let invite_notify = this.obContext.apis.MsgApi.notifyGroupInvite.get(request.flag);
const invite_notify = this.obContext.apis.MsgApi.notifyGroupInvite.get(request.flag);
const notify = invite_notify ?? await this.findNotify(request.flag);
if (!isNull(quickAction.approve) && notify) {