js-qqbot
Version:
基于go-cqhttp的qq机器人js框架
34 lines (33 loc) • 1.27 kB
TypeScript
/// <reference types="express-serve-static-core" />
import * as WebSocket from 'ws';
import * as schedule from 'node-schedule';
export declare type SocketFn = (socket: WebSocket) => void;
export interface IPlugin {
init: (bot: QQBot) => void;
}
export declare type IPluginFn = (bot: QQBot) => void;
export declare type IEventFn = (data?: any, socket?: WebSocket, ws?: WebSocket.Server, app?: Express.Application) => void;
export declare type IEventMap = IEventFn[];
export declare class QQBot {
ws: WebSocket.Server;
app: import("express-serve-static-core").Express;
server: any;
port: number;
path: string;
private eventHandlerMap;
private plugins;
socket: WebSocket;
schedule: typeof schedule;
private _id;
private pluginsCache;
static runTag: boolean;
constructor(port?: number, path?: string);
private _init;
run(fn?: SocketFn): void;
private handleWrong;
on(event: 'private' | 'notice' | 'error' | 'close' | 'unexpected-response', handle: (data: any, socket: WebSocket, ws?: WebSocket.Server, app?: Express.Application) => void): void;
use(plugin: IPlugin & IPluginFn): this;
private excutePlugins;
}
export { createPrivateSender } from './utils';
export { wether, self } from './plugins';