NapCatQQ source snapshot
This commit is contained in:
commit
f954252a34
1111 files changed
+139867
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export class BotOfflineEvent extends OB11BaseNoticeEvent {
|
||||
notice_type = 'bot_offline';
|
||||
user_id: number;
|
||||
tag: string = 'BotOfflineEvent';
|
||||
message: string = 'BotOfflineEvent';
|
||||
|
||||
public constructor (core: NapCatCore, tag: string, message: string) {
|
||||
super(core);
|
||||
this.user_id = +core.selfInfo.uin;
|
||||
this.tag = tag;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { EventType, OneBotEvent } from '@/napcat-onebot/event/OneBotEvent';
|
||||
|
||||
export abstract class OB11BaseNoticeEvent extends OneBotEvent {
|
||||
post_type = EventType.NOTICE;
|
||||
abstract notice_type: string;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export class OB11FriendAddNoticeEvent extends OB11BaseNoticeEvent {
|
||||
notice_type = 'friend_add';
|
||||
user_id: number;
|
||||
|
||||
public constructor (core: NapCatCore, userId: number) {
|
||||
super(core);
|
||||
this.user_id = userId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export class OB11FriendRecallNoticeEvent extends OB11BaseNoticeEvent {
|
||||
notice_type = 'friend_recall';
|
||||
user_id: number;
|
||||
message_id: number;
|
||||
|
||||
public constructor (core: NapCatCore, userId: number, messageId: number) {
|
||||
super(core);
|
||||
this.user_id = userId;
|
||||
this.message_id = messageId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export class OB11GroupAdminNoticeEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'group_admin';
|
||||
sub_type: 'set' | 'unset';
|
||||
|
||||
constructor (core: NapCatCore, group_id: number, user_id: number, sub_type: 'set' | 'unset') {
|
||||
super(core, group_id, user_id);
|
||||
this.sub_type = sub_type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export class OB11GroupBanEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'group_ban';
|
||||
operator_id: number;
|
||||
duration: number;
|
||||
sub_type: 'ban' | 'lift_ban';
|
||||
|
||||
constructor (core: NapCatCore, groupId: number, userId: number, operatorId: number, duration: number, sub_type: 'ban' | 'lift_ban') {
|
||||
super(core, groupId, userId);
|
||||
this.group_id = groupId;
|
||||
this.operator_id = operatorId;
|
||||
this.user_id = userId;
|
||||
this.duration = duration;
|
||||
this.sub_type = sub_type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export class OB11GroupCardEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'group_card';
|
||||
card_new: string;
|
||||
card_old: string;
|
||||
|
||||
constructor (core: NapCatCore, groupId: number, userId: number, cardNew: string, cardOld: string) {
|
||||
super(core, groupId, userId);
|
||||
this.group_id = groupId;
|
||||
this.user_id = userId;
|
||||
this.card_new = cardNew;
|
||||
this.card_old = cardOld;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export type GroupDecreaseSubType = 'leave' | 'kick' | 'kick_me' | 'disband';
|
||||
|
||||
export class OB11GroupDecreaseEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'group_decrease';
|
||||
sub_type: GroupDecreaseSubType = 'leave';
|
||||
operator_id: number;
|
||||
|
||||
constructor (core: NapCatCore, groupId: number, userId: number, operatorId: number, subType: GroupDecreaseSubType = 'leave') {
|
||||
super(core, groupId, userId);
|
||||
this.group_id = groupId;
|
||||
this.operator_id = operatorId;
|
||||
this.user_id = userId;
|
||||
this.sub_type = subType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export class OB11GroupEssenceEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'essence';
|
||||
message_id: number;
|
||||
sender_id: number;
|
||||
operator_id: number;
|
||||
sub_type: 'add' | 'delete' = 'add';
|
||||
|
||||
constructor (core: NapCatCore, groupId: number, message_id: number, sender_id: number, operator_id: number) {
|
||||
super(core, groupId, sender_id);
|
||||
this.group_id = groupId;
|
||||
this.operator_id = operator_id;
|
||||
this.message_id = message_id;
|
||||
this.sender_id = sender_id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
/**
|
||||
* 群灰条消息事件
|
||||
* 用于上报未知类型的灰条消息,便于下游检测和处理伪造灰条攻击
|
||||
*/
|
||||
export class OB11GroupGrayTipEvent extends OB11BaseNoticeEvent {
|
||||
notice_type = 'notify';
|
||||
sub_type = 'gray_tip';
|
||||
group_id: number;
|
||||
user_id: number; // 真实发送者QQ(如果是伪造的灰条,这就是攻击者)
|
||||
message_id: number; // 消息ID,可用于撤回
|
||||
busi_id: string; // 业务ID
|
||||
content: string; // 灰条内容(JSON字符串)
|
||||
raw_info: unknown; // 原始信息
|
||||
|
||||
constructor (
|
||||
core: NapCatCore,
|
||||
groupId: number,
|
||||
userId: number,
|
||||
messageId: number,
|
||||
busiId: string,
|
||||
content: string,
|
||||
rawInfo: unknown
|
||||
) {
|
||||
super(core);
|
||||
this.group_id = groupId;
|
||||
this.user_id = userId;
|
||||
this.message_id = messageId;
|
||||
this.busi_id = busiId;
|
||||
this.content = content;
|
||||
this.raw_info = rawInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
type GroupIncreaseSubType = 'approve' | 'invite';
|
||||
|
||||
export class OB11GroupIncreaseEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'group_increase';
|
||||
operator_id: number;
|
||||
sub_type: GroupIncreaseSubType;
|
||||
|
||||
constructor (core: NapCatCore, groupId: number, userId: number, operatorId: number, subType: GroupIncreaseSubType = 'approve') {
|
||||
super(core, groupId, userId);
|
||||
this.group_id = groupId;
|
||||
this.operator_id = operatorId;
|
||||
this.user_id = userId;
|
||||
this.sub_type = subType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export class OB11GroupNameEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'notify';
|
||||
sub_type = 'group_name';
|
||||
name_new: string;
|
||||
|
||||
constructor (core: NapCatCore, groupId: number, userId: number, nameNew: string) {
|
||||
super(core, groupId, userId);
|
||||
this.name_new = nameNew;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export abstract class OB11GroupNoticeEvent extends OB11BaseNoticeEvent {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export class OB11GroupRecallNoticeEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'group_recall';
|
||||
operator_id: number;
|
||||
message_id: number;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export class OB11GroupTitleEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'notify';
|
||||
sub_type = 'title';
|
||||
title: string;
|
||||
|
||||
constructor (core: NapCatCore, groupId: number, userId: number, title: string) {
|
||||
super(core, groupId, userId);
|
||||
this.group_id = groupId;
|
||||
this.user_id = userId;
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export interface GroupUploadFile {
|
||||
id: string,
|
||||
name: string,
|
||||
size: number,
|
||||
busid: number,
|
||||
}
|
||||
|
||||
export class OB11GroupUploadNoticeEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'group_upload';
|
||||
file: GroupUploadFile;
|
||||
|
||||
constructor (core: NapCatCore, groupId: number, userId: number, file: GroupUploadFile) {
|
||||
super(core, groupId, userId);
|
||||
this.group_id = groupId;
|
||||
this.user_id = userId;
|
||||
this.file = file;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
// TODO: 输入状态事件 初步完成 Mlikiowa 需要做一些过滤
|
||||
export class OB11InputStatusEvent extends OB11BaseNoticeEvent {
|
||||
notice_type = 'notify';
|
||||
sub_type = 'input_status';
|
||||
status_text = '对方正在输入...';
|
||||
event_type = 1;
|
||||
user_id = 0;
|
||||
group_id = 0;
|
||||
|
||||
constructor (core: NapCatCore, user_id: number, eventType: number, status_text: string) {
|
||||
super(core);
|
||||
this.user_id = user_id;
|
||||
this.event_type = eventType;
|
||||
this.status_text = status_text;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export interface MsgEmojiLike {
|
||||
emoji_id: string,
|
||||
count: number;
|
||||
}
|
||||
|
||||
export class OB11GroupMsgEmojiLikeEvent extends OB11GroupNoticeEvent {
|
||||
notice_type = 'group_msg_emoji_like';
|
||||
message_id: number;
|
||||
likes: MsgEmojiLike[];
|
||||
is_add: boolean;
|
||||
message_seq?: string;
|
||||
|
||||
constructor (core: NapCatCore, groupId: number, userId: number, messageId: number, likes: MsgEmojiLike[], isAdd: boolean, _messageSeq?: string) {
|
||||
super(core, groupId, userId);
|
||||
this.group_id = groupId;
|
||||
this.user_id = userId; // 可为空,表示是对别人的消息操作,如果是对bot自己的消息则不为空
|
||||
this.message_id = messageId;
|
||||
this.likes = likes;
|
||||
this.is_add = isAdd;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export abstract class OB11OnlineFileNoticeEvent extends OB11BaseNoticeEvent {
|
||||
peer_id: number;
|
||||
|
||||
protected constructor (core: NapCatCore, peer_id: number) {
|
||||
super(core);
|
||||
this.peer_id = peer_id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { OB11OnlineFileNoticeEvent } from './OB11OnlineFileNoticeEvent';
|
||||
import { NapCatCore } from '@/napcat-core';
|
||||
|
||||
export class OB11OnlineFileReceiveEvent extends OB11OnlineFileNoticeEvent {
|
||||
notice_type: string;
|
||||
sub_type: string;
|
||||
|
||||
constructor (core: NapCatCore, peer_id: number) {
|
||||
super(core, peer_id);
|
||||
this.notice_type = 'online_file_receive';
|
||||
this.sub_type = 'cancel';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { OB11OnlineFileNoticeEvent } from './OB11OnlineFileNoticeEvent';
|
||||
import { NapCatCore } from '@/napcat-core';
|
||||
|
||||
export class OB11OnlineFileSendEvent extends OB11OnlineFileNoticeEvent {
|
||||
notice_type = 'online_file_send';
|
||||
sub_type: 'receive' | 'refuse';
|
||||
|
||||
constructor (core: NapCatCore, peer_id: number, sub_type: 'receive' | 'refuse') {
|
||||
super(core, peer_id);
|
||||
this.sub_type = sub_type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
class OB11PokeEvent extends OB11BaseNoticeEvent {
|
||||
notice_type = 'notify';
|
||||
sub_type = 'poke';
|
||||
target_id = 0;
|
||||
user_id = 0;
|
||||
}
|
||||
|
||||
export class OB11FriendPokeEvent extends OB11PokeEvent {
|
||||
raw_info: unknown;
|
||||
sender_id: number;
|
||||
|
||||
// raw_message nb等框架标准为string
|
||||
constructor (core: NapCatCore, user_id: number, sender_id: number, target_id: number, raw_message: unknown) {
|
||||
super(core);
|
||||
this.target_id = target_id;
|
||||
this.user_id = user_id;
|
||||
this.sender_id = sender_id;
|
||||
this.raw_info = raw_message;
|
||||
}
|
||||
}
|
||||
|
||||
export class OB11GroupPokeEvent extends OB11PokeEvent {
|
||||
group_id: number;
|
||||
raw_info: unknown;
|
||||
|
||||
// raw_message nb等框架标准为string
|
||||
constructor (core: NapCatCore, group_id: number, user_id: number, target_id: number, raw_message: unknown) {
|
||||
super(core);
|
||||
this.group_id = group_id;
|
||||
this.target_id = target_id;
|
||||
this.user_id = user_id;
|
||||
this.raw_info = raw_message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||
import { NapCatCore } from 'napcat-core';
|
||||
|
||||
export class OB11ProfileLikeEvent extends OB11BaseNoticeEvent {
|
||||
notice_type = 'notify';
|
||||
sub_type = 'profile_like';
|
||||
operator_id: number;
|
||||
operator_nick: string;
|
||||
times: number;
|
||||
override time: number;
|
||||
|
||||
constructor (core: NapCatCore, operatorId: number, operatorNick: string, times: number, time: number) {
|
||||
super(core);
|
||||
this.operator_id = operatorId;
|
||||
this.operator_nick = operatorNick;
|
||||
this.times = times;
|
||||
this.time = time;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
export * from './BotOfflineEvent';
|
||||
export * from './OB11BaseNoticeEvent';
|
||||
export * from './OB11FriendAddNoticeEvent';
|
||||
export * from './OB11FriendRecallNoticeEvent';
|
||||
export * from './OB11GroupAdminNoticeEvent';
|
||||
export * from './OB11GroupBanEvent';
|
||||
export * from './OB11GroupCardEvent';
|
||||
export * from './OB11GroupDecreaseEvent';
|
||||
export * from './OB11GroupEssenceEvent';
|
||||
export * from './OB11GroupGrayTipEvent';
|
||||
export * from './OB11GroupIncreaseEvent';
|
||||
export * from './OB11GroupNameEvent';
|
||||
export * from './OB11GroupNoticeEvent';
|
||||
export * from './OB11GroupRecallNoticeEvent';
|
||||
export * from './OB11GroupTitleEvent';
|
||||
export * from './OB11GroupUploadNoticeEvent';
|
||||
export * from './OB11InputStatusEvent';
|
||||
export * from './OB11MsgEmojiLikeEvent';
|
||||
export * from './OB11OnlineFileNoticeEvent';
|
||||
export * from './OB11OnlineFileReceiveEvent';
|
||||
export * from './OB11OnlineFileSendEvent';
|
||||
export * from './OB11PokeEvent';
|
||||
export * from './OB11ProfileLikeEvent';
|
||||
Reference in new issue
Block a user