xmppjs-chat-bot
Version:
Server-side XMPP chat bot
38 lines (37 loc) • 1.08 kB
TypeScript
import { Options as ClientOptions } from '@xmpp/client';
import { Options as ComponentOptions } from '@xmpp/component';
import { Bot } from '../bot';
import { Logger } from '../logger';
interface ConfigHandler {
id: string;
type: string;
enabled?: boolean;
options: any;
}
interface RoomConf {
local: string;
domain: string;
nick?: string;
enabled?: boolean;
handlers: ConfigHandler[];
}
interface ConfigBase {
xmpp_debug?: boolean;
name?: string;
logger?: 'ConsoleLogger';
log_level?: string;
rooms?: RoomConf[];
handlers?: ConfigHandler[];
}
interface ConfigClient extends ConfigBase {
type: 'client';
connection: ClientOptions;
}
interface ConfigComponent extends ConfigBase {
type: 'component';
connection: ComponentOptions;
}
type Config = ConfigClient | ConfigComponent;
declare function getBotFromConfig(config: Config | string): Promise<Bot>;
declare function readRoomConf(config: string | any, logger?: Logger): Promise<RoomConf | null>;
export { getBotFromConfig, readRoomConf, RoomConf, Config };