mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 21:10:23 +00:00
chore: style&&lint
This commit is contained in:
@@ -26,14 +26,14 @@ export class SetInputStatus extends BaseAction<Payload, any> {
|
||||
peer = {
|
||||
chatType: ChatType.group,
|
||||
peerUid: payload.group_id
|
||||
}
|
||||
};
|
||||
} else if (payload.user_id) {
|
||||
let uid = await NTQQUserApi.getUidByUinV2(payload.user_id);
|
||||
const uid = await NTQQUserApi.getUidByUinV2(payload.user_id);
|
||||
if (!uid) throw new Error('uid is empty');
|
||||
peer = {
|
||||
chatType: ChatType.friend,
|
||||
peerUid: uid
|
||||
}
|
||||
};
|
||||
} else {
|
||||
throw new Error('请指定 group_id 或 user_id');
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export default class GoCQHTTPGetStrangerInfo extends BaseAction<Payload, OB11Use
|
||||
level: calcQQLevel(extendData.detail.commonExt?.qqLevel ?? 0) || 0,
|
||||
login_days: 0,
|
||||
uid: ''
|
||||
};
|
||||
};
|
||||
return ret;
|
||||
}
|
||||
const data = { ...extendData, ...(await NTQQUserApi.getUserDetailInfo(uid)) };
|
||||
|
||||
@@ -44,9 +44,9 @@ export default class SetGroupPortrait extends BaseAction<Payload, any> {
|
||||
}
|
||||
// log(`头像设置返回:${JSON.stringify(ret)}`)
|
||||
if (ret['result'] == 1004022) {
|
||||
throw `头像${payload.file}设置失败,文件可能不是图片格式或权限不足`;
|
||||
throw `头像${payload.file}设置失败,文件可能不是图片格式或权限不足`;
|
||||
} else if (ret['result'] != 0) {
|
||||
throw `头像${payload.file}设置失败,未知的错误,${ret['result']}:${ret['errMsg']}`;
|
||||
throw `头像${payload.file}设置失败,未知的错误,${ret['result']}:${ret['errMsg']}`;
|
||||
}
|
||||
return ret;
|
||||
} else {
|
||||
|
||||
@@ -61,7 +61,7 @@ import { TranslateEnWordToZn } from './extends/TranslateEnWordToZn';
|
||||
import { SetGroupFileFolder } from './file/SetGroupFileFolder';
|
||||
import { DelGroupFile } from './file/DelGroupFile';
|
||||
import { DelGroupFileFolder } from './file/DelGroupFileFolder';
|
||||
import { SetQQProfile } from './go-cqhttp/SetQQProfile'
|
||||
import { SetQQProfile } from './go-cqhttp/SetQQProfile';
|
||||
import { ShareGroupEx, SharePeer } from './extends/ShareContact';
|
||||
import { CreateCollection } from './extends/CreateCollection';
|
||||
import { SetLongNick } from './extends/SetLongNick';
|
||||
|
||||
@@ -73,7 +73,7 @@ export class OneBotGroupApi {
|
||||
}
|
||||
async parseGroupMemberIncreaseEvent(GroupCode: string, grayTipElement: GrayTipElement) {
|
||||
const NTQQGroupApi = this.coreContext.apis.GroupApi;
|
||||
let groupElement = grayTipElement?.groupElement;
|
||||
const groupElement = grayTipElement?.groupElement;
|
||||
if (!groupElement) return undefined;
|
||||
const member = await NTQQGroupApi.getGroupMember(GroupCode, groupElement.memberUid);
|
||||
const memberUin = member?.uin;
|
||||
@@ -92,7 +92,7 @@ export class OneBotGroupApi {
|
||||
async parseGroupKickEvent(GroupCode: string, grayTipElement: GrayTipElement) {
|
||||
const NTQQGroupApi = this.coreContext.apis.GroupApi;
|
||||
const NTQQUserApi = this.coreContext.apis.UserApi;
|
||||
let groupElement = grayTipElement?.groupElement;
|
||||
const groupElement = grayTipElement?.groupElement;
|
||||
if (!groupElement) return undefined;
|
||||
const adminUin = (await NTQQGroupApi.getGroupMember(GroupCode, groupElement.adminUid))?.uin || (await NTQQUserApi.getUidByUinV2(groupElement.adminUid));
|
||||
if (adminUin) {
|
||||
@@ -121,7 +121,7 @@ export class OneBotGroupApi {
|
||||
chatType: ChatType.group,
|
||||
guildId: '',
|
||||
peerUid: GroupCode
|
||||
}
|
||||
};
|
||||
const replyMsgList = (await NTQQMsgApi.getMsgExBySeq(peer, msgSeq)).msgList;
|
||||
if (replyMsgList.length < 1) {
|
||||
return;
|
||||
|
||||
@@ -19,7 +19,7 @@ export async function NT2PrivateEvent(core: NapCatCore, obContext: NapCatOneBot1
|
||||
if (element.grayTipElement) {
|
||||
if (element.grayTipElement.subElementType == NTGrayTipElementSubTypeV2.GRAYTIP_ELEMENT_SUBTYPE_JSON) {
|
||||
if (element.grayTipElement.jsonGrayTipElement.busiId == 1061) {
|
||||
let PokeEvent = await obContext.apiContext.FriendApi.parsePrivatePokeEvent(element.grayTipElement);
|
||||
const PokeEvent = await obContext.apiContext.FriendApi.parsePrivatePokeEvent(element.grayTipElement);
|
||||
if (PokeEvent) return PokeEvent;
|
||||
}
|
||||
}
|
||||
@@ -56,15 +56,15 @@ export async function NT2GroupEvent(core: NapCatCore, obContext: NapCatOneBot11A
|
||||
if (element.grayTipElement && element.grayTipElement.groupElement) {
|
||||
const groupElement = element.grayTipElement.groupElement;
|
||||
if (groupElement.type == TipGroupElementType.memberIncrease) {
|
||||
let MemberIncreaseEvent = await obContext.apiContext.GroupApi.parseGroupMemberIncreaseEvent(msg.peerUid, element.grayTipElement);
|
||||
const MemberIncreaseEvent = await obContext.apiContext.GroupApi.parseGroupMemberIncreaseEvent(msg.peerUid, element.grayTipElement);
|
||||
if (MemberIncreaseEvent) return MemberIncreaseEvent;
|
||||
} else if (groupElement.type === TipGroupElementType.ban) {
|
||||
let BanEvent = await obContext.apiContext.GroupApi.parseGroupBanEvent(msg.peerUid, element.grayTipElement);
|
||||
const BanEvent = await obContext.apiContext.GroupApi.parseGroupBanEvent(msg.peerUid, element.grayTipElement);
|
||||
if (BanEvent) return BanEvent;
|
||||
} else if (groupElement.type == TipGroupElementType.kicked) {
|
||||
NTQQGroupApi.quitGroup(msg.peerUid).then();
|
||||
try {
|
||||
let KickEvent = await obContext.apiContext.GroupApi.parseGroupKickEvent(msg.peerUid, element.grayTipElement);
|
||||
const KickEvent = await obContext.apiContext.GroupApi.parseGroupKickEvent(msg.peerUid, element.grayTipElement);
|
||||
if (KickEvent) return KickEvent;
|
||||
} catch (e) {
|
||||
return new OB11GroupDecreaseEvent(
|
||||
@@ -90,11 +90,11 @@ export async function NT2GroupEvent(core: NapCatCore, obContext: NapCatOneBot11A
|
||||
}
|
||||
if (element.grayTipElement) {
|
||||
if (element.grayTipElement.xmlElement?.templId === '10382') {
|
||||
let emojiLikeEvent = await obContext.apiContext.GroupApi.parseGroupEmjioLikeEvent(msg.peerUid, element.grayTipElement);
|
||||
const emojiLikeEvent = await obContext.apiContext.GroupApi.parseGroupEmjioLikeEvent(msg.peerUid, element.grayTipElement);
|
||||
if (emojiLikeEvent) return emojiLikeEvent;
|
||||
}
|
||||
if (element.grayTipElement.subElementType == NTGrayTipElementSubTypeV2.GRAYTIP_ELEMENT_SUBTYPE_XMLMSG) {
|
||||
let GroupIncreaseEvent = await obContext.apiContext.GroupApi.parseGroupMemberIncreaseEvent(msg.peerUid, element.grayTipElement);
|
||||
const GroupIncreaseEvent = await obContext.apiContext.GroupApi.parseGroupMemberIncreaseEvent(msg.peerUid, element.grayTipElement);
|
||||
if (GroupIncreaseEvent) return GroupIncreaseEvent;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { OB11Constructor } from './converter';
|
||||
import { encodeCQCode } from './cqcode';
|
||||
|
||||
|
||||
export async function RawNTMsg2Onebot(
|
||||
export async function RawNTMsg2Onebot(
|
||||
core: NapCatCore,
|
||||
obcore: NapCatOneBot11Adapter,
|
||||
msg: RawMessage,
|
||||
@@ -256,13 +256,13 @@ import { encodeCQCode } from './cqcode';
|
||||
chatType: msg.chatType,
|
||||
guildId: '',
|
||||
},
|
||||
msg.msgId,
|
||||
msg.msgSeq,
|
||||
msg.senderUid,
|
||||
element.elementId,
|
||||
element.elementType.toString(),
|
||||
element.pttElement.fileSize || '0',
|
||||
element.pttElement.fileUuid || ''
|
||||
msg.msgId,
|
||||
msg.msgSeq,
|
||||
msg.senderUid,
|
||||
element.elementId,
|
||||
element.elementType.toString(),
|
||||
element.pttElement.fileSize || '0',
|
||||
element.pttElement.fileUuid || ''
|
||||
);
|
||||
//以uuid作为文件名
|
||||
} else if (element.arkElement) {
|
||||
|
||||
Reference in New Issue
Block a user