@kotori-bot/kotori-plugin-adapter-onebot
Version:
Adapter For Onebot 11
43 lines (42 loc) • 1.55 kB
TypeScript
import { type AdapterConfig, Adapters, type Context, type EventDataApiBase, type Session, Tsu } from 'kotori-bot';
import OnebotApi from './api';
import OnebotElements from './elements';
import type { EventDataType } from './types';
interface EventDataPoke extends EventDataApiBase {
targetId: string;
groupId: string;
}
declare module 'kotori-bot' {
interface EventsMapping {
onebot_poke(session: Session<EventDataPoke>): void;
literal_onebot_raw_data(data: Exclude<EventDataType['data'], undefined> | object): void;
}
}
export declare const config: any;
type OnebotConfig = Tsu.infer<typeof config> & AdapterConfig;
export declare class OnebotAdapter extends Adapters.WebSocket<OnebotApi, OnebotConfig, OnebotElements> {
private readonly address;
private readonly isReverse;
readonly config: OnebotConfig;
readonly elements: OnebotElements;
readonly api: OnebotApi;
readonly platform = "onebot";
pendingRequests: Map<string, {
resolve: (data: unknown) => void;
reject: (err: unknown) => void;
timer: NodeJS.Timeout;
}>;
constructor(ctx: Context, config: OnebotConfig, identity: string);
handle(data: EventDataType | {
echo: string;
status: 'ok' | 'failed';
data: unknown;
}): void;
start(): void;
stop(): void;
send(content: EventDataType, operation?: object): void;
call<T = void>(action: string, params?: unknown): Promise<T>;
private socket;
private onlineTimerId;
}
export default OnebotAdapter;