Add ESLint config and update code style
Introduced a new eslint.config.js using neostandard and added related devDependencies. Updated codebase for consistent formatting, spacing, and function declarations. Minor refactoring and cleanup across multiple files to improve readability and maintain code style compliance.
This commit is contained in:
1 parent
54aef4fe1d
commit
26e84653d6
42 files changed
+628
-580
No files matched your search
@@ -1,37 +1,36 @@
|
||||
import { NapProtoMsg } from "napcat-protobuf";
|
||||
import { ReceiveService, ServiceBase } from "../packet/handler/serviceRegister";
|
||||
import { GroupReactNotify, PushMsg } from "../packet/transformer/proto";
|
||||
import { NapProtoMsg } from 'napcat-protobuf';
|
||||
import { ReceiveService, ServiceBase } from '../packet/handler/serviceRegister';
|
||||
import { GroupReactNotify, PushMsg } from '../packet/transformer/proto';
|
||||
|
||||
@ReceiveService('trpc.msg.olpush.OlPushService.MsgPush')
|
||||
export class OlPushService extends ServiceBase {
|
||||
async handler(_seq: number, hex_data: string) {
|
||||
const data = new NapProtoMsg(PushMsg).decode(Buffer.from(hex_data, 'hex'));
|
||||
if (data.message.contentHead.type === 732 && data.message.contentHead.subType === 16) {
|
||||
const pbNotify = data.message.body?.msgContent?.slice(7);
|
||||
if (!pbNotify) {
|
||||
return;
|
||||
}
|
||||
// 开始解析Notify
|
||||
const notify = new NapProtoMsg(GroupReactNotify).decode(pbNotify);
|
||||
if ((notify.field13 ?? 0) === 35) {
|
||||
// Group React Notify
|
||||
const groupCode = notify.groupUin?.toString() ?? '';
|
||||
const operatorUid = notify.groupReactionData?.data?.data?.groupReactionDataContent?.operatorUid ?? '';
|
||||
const type = notify.groupReactionData?.data?.data?.groupReactionDataContent?.type ?? 0;
|
||||
const seq = notify.groupReactionData?.data?.data?.groupReactionTarget?.seq?.toString() ?? '';
|
||||
const code = notify.groupReactionData?.data?.data?.groupReactionDataContent?.code ?? '';
|
||||
const count = notify.groupReactionData?.data?.data?.groupReactionDataContent?.count ?? 0;
|
||||
const senderUin = await this.core.apis.UserApi.getUinByUidV2(operatorUid);
|
||||
this.event.emit('event:emoji_like', {
|
||||
groupId: groupCode,
|
||||
senderUin: senderUin,
|
||||
emojiId: code,
|
||||
msgSeq: seq,
|
||||
isAdd: type === 1,
|
||||
count: count
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async handler (_seq: number, hex_data: string) {
|
||||
const data = new NapProtoMsg(PushMsg).decode(Buffer.from(hex_data, 'hex'));
|
||||
if (data.message.contentHead.type === 732 && data.message.contentHead.subType === 16) {
|
||||
const pbNotify = data.message.body?.msgContent?.slice(7);
|
||||
if (!pbNotify) {
|
||||
return;
|
||||
}
|
||||
// 开始解析Notify
|
||||
const notify = new NapProtoMsg(GroupReactNotify).decode(pbNotify);
|
||||
if ((notify.field13 ?? 0) === 35) {
|
||||
// Group React Notify
|
||||
const groupCode = notify.groupUin?.toString() ?? '';
|
||||
const operatorUid = notify.groupReactionData?.data?.data?.groupReactionDataContent?.operatorUid ?? '';
|
||||
const type = notify.groupReactionData?.data?.data?.groupReactionDataContent?.type ?? 0;
|
||||
const seq = notify.groupReactionData?.data?.data?.groupReactionTarget?.seq?.toString() ?? '';
|
||||
const code = notify.groupReactionData?.data?.data?.groupReactionDataContent?.code ?? '';
|
||||
const count = notify.groupReactionData?.data?.data?.groupReactionDataContent?.count ?? 0;
|
||||
const senderUin = await this.core.apis.UserApi.getUinByUidV2(operatorUid);
|
||||
this.event.emit('event:emoji_like', {
|
||||
groupId: groupCode,
|
||||
senderUin,
|
||||
emojiId: code,
|
||||
msgSeq: seq,
|
||||
isAdd: type === 1,
|
||||
count,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user