chore: run eslint --fix in onebot module

This commit is contained in:
Wesley F. Young
2024-08-09 20:35:03 +08:00
parent f5b6fa31a7
commit af01a073ef
110 changed files with 3832 additions and 3829 deletions

View File

@@ -10,7 +10,7 @@ export enum EventType {
export abstract class OB11BaseEvent {
time = Math.floor(Date.now() / 1000);
self_id = parseInt(selfInfo.uin);
post_type: EventType = EventType.META;
time = Math.floor(Date.now() / 1000);
self_id = parseInt(selfInfo.uin);
post_type: EventType = EventType.META;
}

View File

@@ -1,5 +1,5 @@
import { EventType, OB11BaseEvent } from '../OB11BaseEvent';
export abstract class OB11BaseMessageEvent extends OB11BaseEvent {
post_type = EventType.MESSAGE;
post_type = EventType.MESSAGE;
}

View File

@@ -1,6 +1,6 @@
import { EventType, OB11BaseEvent } from '../OB11BaseEvent';
export abstract class OB11BaseMetaEvent extends OB11BaseEvent {
post_type = EventType.META;
meta_event_type: string;
post_type = EventType.META;
meta_event_type: string;
}

View File

@@ -6,16 +6,16 @@ interface HeartbeatStatus {
}
export class OB11HeartbeatEvent extends OB11BaseMetaEvent {
meta_event_type = 'heartbeat';
status: HeartbeatStatus;
interval: number;
meta_event_type = 'heartbeat';
status: HeartbeatStatus;
interval: number;
public constructor(isOnline: boolean, isGood: boolean, interval: number) {
super();
this.interval = interval;
this.status = {
online: isOnline,
good: isGood
};
}
public constructor(isOnline: boolean, isGood: boolean, interval: number) {
super();
this.interval = interval;
this.status = {
online: isOnline,
good: isGood
};
}
}

View File

@@ -7,11 +7,11 @@ export enum LifeCycleSubType {
}
export class OB11LifeCycleEvent extends OB11BaseMetaEvent {
meta_event_type = 'lifecycle';
sub_type: LifeCycleSubType;
meta_event_type = 'lifecycle';
sub_type: LifeCycleSubType;
public constructor(subType: LifeCycleSubType) {
super();
this.sub_type = subType;
}
public constructor(subType: LifeCycleSubType) {
super();
this.sub_type = subType;
}
}

View File

@@ -1,5 +1,5 @@
import { EventType, OB11BaseEvent } from '../OB11BaseEvent';
export abstract class OB11BaseNoticeEvent extends OB11BaseEvent {
post_type = EventType.NOTICE;
post_type = EventType.NOTICE;
}

View File

@@ -1,11 +1,11 @@
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
export class OB11FriendAddNoticeEvent extends OB11BaseNoticeEvent {
notice_type = 'friend_add';
user_id: number;
notice_type = 'friend_add';
user_id: number;
public constructor(user_Id: number) {
super();
this.user_id = user_Id;
}
public constructor(user_Id: number) {
super();
this.user_id = user_Id;
}
}

View File

@@ -1,13 +1,13 @@
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
export class OB11FriendRecallNoticeEvent extends OB11BaseNoticeEvent {
notice_type = 'friend_recall';
user_id: number;
message_id: number;
notice_type = 'friend_recall';
user_id: number;
message_id: number;
public constructor(userId: number, messageId: number) {
super();
this.user_id = userId;
this.message_id = messageId;
}
public constructor(userId: number, messageId: number) {
super();
this.user_id = userId;
this.message_id = messageId;
}
}

View File

@@ -1,6 +1,6 @@
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
export class OB11GroupAdminNoticeEvent extends OB11GroupNoticeEvent {
notice_type = 'group_admin';
sub_type: 'set' | 'unset' = "set"; // "set" | "unset"
notice_type = 'group_admin';
sub_type: 'set' | 'unset' = "set"; // "set" | "unset"
}

View File

@@ -1,17 +1,17 @@
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
export class OB11GroupBanEvent extends OB11GroupNoticeEvent {
notice_type = 'group_ban';
operator_id: number;
duration: number;
sub_type: 'ban' | 'lift_ban';
notice_type = 'group_ban';
operator_id: number;
duration: number;
sub_type: 'ban' | 'lift_ban';
constructor(groupId: number, userId: number, operatorId: number, duration: number, sub_type: 'ban' | 'lift_ban') {
super();
this.group_id = groupId;
this.operator_id = operatorId;
this.user_id = userId;
this.duration = duration;
this.sub_type = sub_type;
}
constructor(groupId: number, userId: number, operatorId: number, duration: number, sub_type: 'ban' | 'lift_ban') {
super();
this.group_id = groupId;
this.operator_id = operatorId;
this.user_id = userId;
this.duration = duration;
this.sub_type = sub_type;
}
}

View File

@@ -1,16 +1,16 @@
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
export class OB11GroupCardEvent extends OB11GroupNoticeEvent {
notice_type = 'group_card';
card_new: string;
card_old: string;
notice_type = 'group_card';
card_new: string;
card_old: string;
constructor(groupId: number, userId: number, cardNew: string, cardOld: string) {
super();
this.group_id = groupId;
this.user_id = userId;
this.card_new = cardNew;
this.card_old = cardOld;
}
constructor(groupId: number, userId: number, cardNew: string, cardOld: string) {
super();
this.group_id = groupId;
this.user_id = userId;
this.card_new = cardNew;
this.card_old = cardOld;
}
}

View File

@@ -3,15 +3,15 @@ import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
export type GroupDecreaseSubType = 'leave' | 'kick' | 'kick_me';
export class OB11GroupDecreaseEvent extends OB11GroupNoticeEvent {
notice_type = 'group_decrease';
sub_type: GroupDecreaseSubType = 'leave'; // TODO: 实现其他几种子类型的识别 ("leave" | "kick" | "kick_me")
operator_id: number;
notice_type = 'group_decrease';
sub_type: GroupDecreaseSubType = 'leave'; // TODO: 实现其他几种子类型的识别 ("leave" | "kick" | "kick_me")
operator_id: number;
constructor(groupId: number, userId: number, operatorId: number, subType: GroupDecreaseSubType = 'leave') {
super();
this.group_id = groupId;
this.operator_id = operatorId; // 实际上不应该这么实现,但是现在还没有办法识别用户是被踢出的,还是自己主动退出的
this.user_id = userId;
this.sub_type = subType;
}
constructor(groupId: number, userId: number, operatorId: number, subType: GroupDecreaseSubType = 'leave') {
super();
this.group_id = groupId;
this.operator_id = operatorId; // 实际上不应该这么实现,但是现在还没有办法识别用户是被踢出的,还是自己主动退出的
this.user_id = userId;
this.sub_type = subType;
}
}

View File

@@ -1,14 +1,14 @@
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
export class OB11GroupEssenceEvent extends OB11GroupNoticeEvent {
notice_type = 'essence';
message_id: number;
sender_id: number;
sub_type: 'add' | 'delete' = 'add';
notice_type = 'essence';
message_id: number;
sender_id: number;
sub_type: 'add' | 'delete' = 'add';
constructor(groupId: number, message_id: number, sender_id: number) {
super();
this.group_id = groupId;
this.message_id = message_id;
this.sender_id = sender_id;
}
constructor(groupId: number, message_id: number, sender_id: number) {
super();
this.group_id = groupId;
this.message_id = message_id;
this.sender_id = sender_id;
}
}

View File

@@ -2,14 +2,14 @@ import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
type GroupIncreaseSubType = 'approve' | 'invite';
export class OB11GroupIncreaseEvent extends OB11GroupNoticeEvent {
notice_type = 'group_increase';
operator_id: number;
sub_type: GroupIncreaseSubType;
constructor(groupId: number, userId: number, operatorId: number, subType: GroupIncreaseSubType = 'approve') {
super();
this.group_id = groupId;
this.operator_id = operatorId;
this.user_id = userId;
this.sub_type = subType;
}
notice_type = 'group_increase';
operator_id: number;
sub_type: GroupIncreaseSubType;
constructor(groupId: number, userId: number, operatorId: number, subType: GroupIncreaseSubType = 'approve') {
super();
this.group_id = groupId;
this.operator_id = operatorId;
this.user_id = userId;
this.sub_type = subType;
}
}

View File

@@ -1,6 +1,6 @@
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
export abstract class OB11GroupNoticeEvent extends OB11BaseNoticeEvent {
group_id: number = 0;
user_id: number = 0;
group_id: number = 0;
user_id: number = 0;
}

View File

@@ -1,15 +1,15 @@
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
export class OB11GroupRecallNoticeEvent extends OB11GroupNoticeEvent {
notice_type = 'group_recall';
operator_id: number;
message_id: number;
notice_type = 'group_recall';
operator_id: number;
message_id: number;
constructor(groupId: number, userId: number, operatorId: number, messageId: number) {
super();
this.group_id = groupId;
this.user_id = userId;
this.operator_id = operatorId;
this.message_id = messageId;
}
constructor(groupId: number, userId: number, operatorId: number, messageId: number) {
super();
this.group_id = groupId;
this.user_id = userId;
this.operator_id = operatorId;
this.message_id = messageId;
}
}

View File

@@ -1,15 +1,15 @@
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
export class OB11GroupTitleEvent extends OB11GroupNoticeEvent {
notice_type = 'notify';
sub_type = 'title';
title: string;
notice_type = 'notify';
sub_type = 'title';
title: string;
constructor(groupId: number, userId: number, title: string) {
super();
this.group_id = groupId;
this.user_id = userId;
this.title = title;
}
constructor(groupId: number, userId: number, title: string) {
super();
this.group_id = groupId;
this.user_id = userId;
this.title = title;
}
}

View File

@@ -8,13 +8,13 @@ export interface GroupUploadFile{
}
export class OB11GroupUploadNoticeEvent extends OB11GroupNoticeEvent {
notice_type = 'group_upload';
file: GroupUploadFile;
notice_type = 'group_upload';
file: GroupUploadFile;
constructor(groupId: number, userId: number, file: GroupUploadFile) {
super();
this.group_id = groupId;
this.user_id = userId;
this.file = file;
}
constructor(groupId: number, userId: number, file: GroupUploadFile) {
super();
this.group_id = groupId;
this.user_id = userId;
this.file = file;
}
}

View File

@@ -1,16 +1,16 @@
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
//输入状态事件 初步完成 Mlikio wa Todo 需要做一些过滤
export class OB11InputStatusEvent extends OB11BaseNoticeEvent {
notice_type = 'notify';
sub_type = 'input_status';
status_text = "对方正在输入..."
eventType = 1;
user_id = 0;
constructor(user_id: number, eventType: number, status_text: string) {
super();
this.user_id = user_id;
this.eventType = eventType;
this.status_text = status_text;
}
notice_type = 'notify';
sub_type = 'input_status';
status_text = "对方正在输入...";
eventType = 1;
user_id = 0;
constructor(user_id: number, eventType: number, status_text: string) {
super();
this.user_id = user_id;
this.eventType = eventType;
this.status_text = status_text;
}
}

View File

@@ -6,15 +6,15 @@ export interface MsgEmojiLike {
}
export class OB11GroupMsgEmojiLikeEvent extends OB11GroupNoticeEvent {
notice_type = 'group_msg_emoji_like';
message_id: number;
likes: MsgEmojiLike[];
notice_type = 'group_msg_emoji_like';
message_id: number;
likes: MsgEmojiLike[];
constructor(groupId: number, userId: number, messageId: number, likes: MsgEmojiLike[]) {
super();
this.group_id = groupId;
this.user_id = userId; // 可为空表示是对别人的消息操作如果是对bot自己的消息则不为空
this.message_id = messageId;
this.likes = likes;
}
constructor(groupId: number, userId: number, messageId: number, likes: MsgEmojiLike[]) {
super();
this.group_id = groupId;
this.user_id = userId; // 可为空表示是对别人的消息操作如果是对bot自己的消息则不为空
this.message_id = messageId;
this.likes = likes;
}
}

View File

@@ -1,32 +1,32 @@
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
class OB11PokeEvent extends OB11BaseNoticeEvent {
notice_type = 'notify';
sub_type = 'poke';
target_id = 0;
user_id = 0;
notice_type = 'notify';
sub_type = 'poke';
target_id = 0;
user_id = 0;
}
export class OB11FriendPokeEvent extends OB11PokeEvent {
raw_info: any;
//raw_message nb等框架标准为string
constructor(user_id: number, target_id: number, raw_message: any) {
super();
this.target_id = target_id;
this.user_id = user_id;
this.raw_info = raw_message;
}
raw_info: any;
//raw_message nb等框架标准为string
constructor(user_id: number, target_id: number, raw_message: any) {
super();
this.target_id = target_id;
this.user_id = user_id;
this.raw_info = raw_message;
}
}
export class OB11GroupPokeEvent extends OB11PokeEvent {
group_id: number;
raw_info: any;
//raw_message nb等框架标准为string
constructor(group_id: number, user_id: number = 0, target_id: number = 0, raw_message: any) {
super();
this.group_id = group_id;
this.target_id = target_id;
this.user_id = user_id;
this.raw_info = raw_message;
}
group_id: number;
raw_info: any;
//raw_message nb等框架标准为string
constructor(group_id: number, user_id: number = 0, target_id: number = 0, raw_message: any) {
super();
this.group_id = group_id;
this.target_id = target_id;
this.user_id = user_id;
this.raw_info = raw_message;
}
}

View File

@@ -3,9 +3,9 @@ import { EventType } from '../OB11BaseEvent';
export class OB11FriendRequestEvent extends OB11BaseNoticeEvent {
post_type = EventType.REQUEST;
user_id: number = 0;
request_type = 'friend' as const;
comment: string = '';
flag: string = '';
post_type = EventType.REQUEST;
user_id: number = 0;
request_type = 'friend' as const;
comment: string = '';
flag: string = '';
}

View File

@@ -3,9 +3,9 @@ import { EventType } from '../OB11BaseEvent';
export class OB11GroupRequestEvent extends OB11GroupNoticeEvent {
post_type = EventType.REQUEST;
request_type = 'group' as const;
sub_type: 'add' | 'invite' = 'add';
comment: string = '';
flag: string = '';
post_type = EventType.REQUEST;
request_type = 'group' as const;
sub_type: 'add' | 'invite' = 'add';
comment: string = '';
flag: string = '';
}