mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-13 08:20:27 +00:00
refactor: add core into all event constructors
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
export class OB11FriendAddNoticeEvent extends OB11BaseNoticeEvent {
|
||||
notice_type = 'friend_add';
|
||||
user_id: number;
|
||||
|
||||
public constructor(user_Id: number) {
|
||||
super();
|
||||
this.user_id = user_Id;
|
||||
public constructor(core: NapCatCore, userId: number) {
|
||||
super(core);
|
||||
this.user_id = userId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
export class OB11FriendRecallNoticeEvent extends OB11BaseNoticeEvent {
|
||||
notice_type = 'friend_recall';
|
||||
user_id: number;
|
||||
message_id: number;
|
||||
|
||||
public constructor(userId: number, messageId: number) {
|
||||
super();
|
||||
public constructor(core: NapCatCore, userId: number, messageId: number) {
|
||||
super(core);
|
||||
this.user_id = userId;
|
||||
this.message_id = messageId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
export class OB11GroupBanEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'group_ban';
|
||||
@@ -6,8 +7,8 @@ export class OB11GroupBanEvent extends OB11GroupNoticeEvent {
|
||||
duration: number;
|
||||
sub_type: 'ban' | 'lift_ban';
|
||||
|
||||
constructor(groupId: number, userId: number, operatorId: number, duration: number, sub_type: 'ban' | 'lift_ban') {
|
||||
super();
|
||||
constructor(core: NapCatCore, groupId: number, userId: number, operatorId: number, duration: number, sub_type: 'ban' | 'lift_ban') {
|
||||
super(core);
|
||||
this.group_id = groupId;
|
||||
this.operator_id = operatorId;
|
||||
this.user_id = userId;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
export class OB11GroupCardEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'group_card';
|
||||
@@ -6,8 +7,8 @@ export class OB11GroupCardEvent extends OB11GroupNoticeEvent {
|
||||
card_old: string;
|
||||
|
||||
|
||||
constructor(groupId: number, userId: number, cardNew: string, cardOld: string) {
|
||||
super();
|
||||
constructor(core: NapCatCore, groupId: number, userId: number, cardNew: string, cardOld: string) {
|
||||
super(core);
|
||||
this.group_id = groupId;
|
||||
this.user_id = userId;
|
||||
this.card_new = cardNew;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
export type GroupDecreaseSubType = 'leave' | 'kick' | 'kick_me';
|
||||
|
||||
@@ -7,8 +8,8 @@ export class OB11GroupDecreaseEvent extends OB11GroupNoticeEvent {
|
||||
sub_type: GroupDecreaseSubType = 'leave'; // TODO: 实现其他几种子类型的识别 ("leave" | "kick" | "kick_me")
|
||||
operator_id: number;
|
||||
|
||||
constructor(groupId: number, userId: number, operatorId: number, subType: GroupDecreaseSubType = 'leave') {
|
||||
super();
|
||||
constructor(core: NapCatCore, groupId: number, userId: number, operatorId: number, subType: GroupDecreaseSubType = 'leave') {
|
||||
super(core);
|
||||
this.group_id = groupId;
|
||||
this.operator_id = operatorId; // 实际上不应该这么实现,但是现在还没有办法识别用户是被踢出的,还是自己主动退出的
|
||||
this.user_id = userId;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
export class OB11GroupEssenceEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'essence';
|
||||
@@ -6,8 +7,8 @@ export class OB11GroupEssenceEvent extends OB11GroupNoticeEvent {
|
||||
sender_id: number;
|
||||
sub_type: 'add' | 'delete' = 'add';
|
||||
|
||||
constructor(groupId: number, message_id: number, sender_id: number) {
|
||||
super();
|
||||
constructor(core: NapCatCore, groupId: number, message_id: number, sender_id: number) {
|
||||
super(core);
|
||||
this.group_id = groupId;
|
||||
this.message_id = message_id;
|
||||
this.sender_id = sender_id;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
type GroupIncreaseSubType = 'approve' | 'invite';
|
||||
|
||||
@@ -7,8 +8,8 @@ export class OB11GroupIncreaseEvent extends OB11GroupNoticeEvent {
|
||||
operator_id: number;
|
||||
sub_type: GroupIncreaseSubType;
|
||||
|
||||
constructor(groupId: number, userId: number, operatorId: number, subType: GroupIncreaseSubType = 'approve') {
|
||||
super();
|
||||
constructor(core: NapCatCore, groupId: number, userId: number, operatorId: number, subType: GroupIncreaseSubType = 'approve') {
|
||||
super(core);
|
||||
this.group_id = groupId;
|
||||
this.operator_id = operatorId;
|
||||
this.user_id = userId;
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
export abstract class OB11GroupNoticeEvent extends OB11BaseNoticeEvent {
|
||||
group_id: number = 0;
|
||||
user_id: number = 0;
|
||||
}
|
||||
group_id: number;
|
||||
user_id: number;
|
||||
|
||||
constructor(core: NapCatCore, group_id: number, user_id: number) {
|
||||
super(core);
|
||||
this.group_id = group_id;
|
||||
this.user_id = user_id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
export class OB11GroupRecallNoticeEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'group_recall';
|
||||
operator_id: number;
|
||||
message_id: number;
|
||||
|
||||
constructor(groupId: number, userId: number, operatorId: number, messageId: number) {
|
||||
super();
|
||||
constructor(core: NapCatCore, groupId: number, userId: number, operatorId: number, messageId: number) {
|
||||
super(core, groupId, userId);
|
||||
this.group_id = groupId;
|
||||
this.user_id = userId;
|
||||
this.operator_id = operatorId;
|
||||
this.message_id = messageId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
export class OB11GroupTitleEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'notify';
|
||||
sub_type = 'title';
|
||||
title: string;
|
||||
|
||||
|
||||
constructor(groupId: number, userId: number, title: string) {
|
||||
super();
|
||||
constructor(core: NapCatCore, groupId: number, userId: number, title: string) {
|
||||
super(core, groupId, userId);
|
||||
this.group_id = groupId;
|
||||
this.user_id = userId;
|
||||
this.title = title;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
export interface GroupUploadFile {
|
||||
id: string,
|
||||
@@ -11,8 +12,8 @@ export class OB11GroupUploadNoticeEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'group_upload';
|
||||
file: GroupUploadFile;
|
||||
|
||||
constructor(groupId: number, userId: number, file: GroupUploadFile) {
|
||||
super();
|
||||
constructor(core: NapCatCore, groupId: number, userId: number, file: GroupUploadFile) {
|
||||
super(core, groupId, userId);
|
||||
this.group_id = groupId;
|
||||
this.user_id = userId;
|
||||
this.file = file;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
//输入状态事件 初步完成 Mlikio wa Todo 需要做一些过滤
|
||||
export class OB11InputStatusEvent extends OB11BaseNoticeEvent {
|
||||
@@ -9,8 +10,8 @@ export class OB11InputStatusEvent extends OB11BaseNoticeEvent {
|
||||
user_id = 0;
|
||||
group_id = 0;
|
||||
|
||||
constructor(user_id: number, eventType: number, status_text: string) {
|
||||
super();
|
||||
constructor(core: NapCatCore, user_id: number, eventType: number, status_text: string) {
|
||||
super(core);
|
||||
this.user_id = user_id;
|
||||
this.eventType = eventType;
|
||||
this.status_text = status_text;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
export interface MsgEmojiLike {
|
||||
emoji_id: string,
|
||||
@@ -10,8 +11,8 @@ export class OB11GroupMsgEmojiLikeEvent extends OB11GroupNoticeEvent {
|
||||
message_id: number;
|
||||
likes: MsgEmojiLike[];
|
||||
|
||||
constructor(groupId: number, userId: number, messageId: number, likes: MsgEmojiLike[]) {
|
||||
super();
|
||||
constructor(core: NapCatCore, groupId: number, userId: number, messageId: number, likes: MsgEmojiLike[]) {
|
||||
super(core, groupId, userId);
|
||||
this.group_id = groupId;
|
||||
this.user_id = userId; // 可为空,表示是对别人的消息操作,如果是对bot自己的消息则不为空
|
||||
this.message_id = messageId;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||
import { NapCatCore } from '@/core';
|
||||
|
||||
class OB11PokeEvent extends OB11BaseNoticeEvent {
|
||||
notice_type = 'notify';
|
||||
@@ -11,8 +12,8 @@ export class OB11FriendPokeEvent extends OB11PokeEvent {
|
||||
raw_info: any;
|
||||
|
||||
//raw_message nb等框架标准为string
|
||||
constructor(user_id: number, target_id: number, raw_message: any) {
|
||||
super();
|
||||
constructor(core: NapCatCore, user_id: number, target_id: number, raw_message: any) {
|
||||
super(core);
|
||||
this.target_id = target_id;
|
||||
this.user_id = user_id;
|
||||
this.raw_info = raw_message;
|
||||
@@ -24,8 +25,8 @@ export class OB11GroupPokeEvent extends OB11PokeEvent {
|
||||
raw_info: any;
|
||||
|
||||
//raw_message nb等框架标准为string
|
||||
constructor(group_id: number, user_id: number = 0, target_id: number = 0, raw_message: any) {
|
||||
super();
|
||||
constructor(core: NapCatCore, group_id: number, user_id: number = 0, target_id: number = 0, raw_message: any) {
|
||||
super(core);
|
||||
this.group_id = group_id;
|
||||
this.target_id = target_id;
|
||||
this.user_id = user_id;
|
||||
|
||||
Reference in New Issue
Block a user