style: 简化写法

This commit is contained in:
手瓜一十雪
2024-12-02 11:16:12 +08:00
parent 5376e16c9f
commit 3b5d2c8f6f
5 changed files with 13 additions and 14 deletions

View File

@@ -14,6 +14,6 @@ export class GetCollectionList extends OneBotAction<Payload, any> {
payloadSchema = SchemaData;
async _handle(payload: Payload) {
return await this.core.apis.CollectionApi.getAllCollection(parseInt(payload.category.toString()), +payload.count);
return await this.core.apis.CollectionApi.getAllCollection(+payload.category, +payload.count);
}
}

View File

@@ -18,7 +18,7 @@ export default class SetGroupBan extends OneBotAction<Payload, null> {
const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
if (!uid) throw new Error('uid error');
await this.core.apis.GroupApi.banMember(payload.group_id.toString(),
[{ uid: uid, timeStamp: parseInt(payload.duration.toString()) }]);
[{ uid: uid, timeStamp: +payload.duration}]);
return null;
}
}

View File

@@ -25,7 +25,7 @@ class ForwardSingleMsg extends OneBotAction<Payload, null> {
}
async _handle(payload: Payload): Promise<null> {
const msg = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString()));
const msg = MessageUnique.getMsgIdAndPeerByShortId(+payload.message_id);
if (!msg) {
throw new Error(`无法找到消息${payload.message_id}`);
}

View File

@@ -16,7 +16,7 @@ export class SetMsgEmojiLike extends OneBotAction<Payload, any> {
payloadSchema = SchemaData;
async _handle(payload: Payload) {
const msg = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString()));
const msg = MessageUnique.getMsgIdAndPeerByShortId(+payload.message_id);
if (!msg) {
throw new Error('msg not found');
}

View File

@@ -452,7 +452,7 @@ export class OneBotMsgApi {
},
[OB11MessageDataType.face]: async ({ data: { id } }) => {
let parsedFaceId = parseInt(id);
let parsedFaceId = +id;
// 从face_config.json中获取表情名称
const sysFaces = faceConfig.sysface;
const face: any = sysFaces.find((systemFace) => systemFace.QSid === parsedFaceId.toString());
@@ -460,7 +460,6 @@ export class OneBotMsgApi {
this.core.context.logger.logError('不支持的ID', id);
return undefined;
}
parsedFaceId = parseInt(parsedFaceId.toString());
let faceType = 1;
if (parsedFaceId >= 222) {
faceType = 2;