umbot
Version:
Universal bot(vk, telegram, viber) or skills for Yandex.Alisa, Маруся and sber
84 lines (83 loc) • 3.05 kB
TypeScript
import { IDbControllerModel } from './models/interface';
import { BotController } from './controller';
export interface IDir {
path: string;
fileName: string;
}
export type TAppType = 'alisa' | 'vk' | 'telegram' | 'viber' | 'marusia' | 'user_application' | 'smart_app';
export declare const T_ALISA: TAppType;
export declare const T_VK: TAppType;
export declare const T_TELEGRAM: TAppType;
export declare const T_VIBER: TAppType;
export declare const T_MARUSIA: TAppType;
export declare const T_SMARTAPP: TAppType;
export declare const T_USER_APP: TAppType;
export declare const WELCOME_INTENT_NAME = "welcome";
export declare const HELP_INTENT_NAME = "help";
export interface IAppDB {
host: string;
user?: string;
pass?: string;
database: string;
options?: Record<string, unknown>;
}
export interface IAppIntent {
name: string;
slots: string[];
is_pattern?: boolean;
}
export interface IAppConfig {
error_log?: string;
json?: string;
db?: IAppDB;
isLocalStorage?: boolean;
env?: string;
}
export interface IAppParam {
viber_token?: string | null;
viber_sender?: string | null;
viber_api_version?: number | null;
telegram_token?: string | null;
vk_api_version?: string | null;
vk_confirmation_token?: string | null;
vk_token?: string | null;
marusia_token?: string | null;
yandex_token?: string | null;
yandex_speech_kit_token?: string | null;
y_isAuthUser?: boolean;
app_id?: string | null;
user_id?: string | number | null;
welcome_text?: string | string[];
help_text?: string | string[];
intents: IAppIntent[] | null;
utm_text?: string | null;
}
export interface ICommandParam<TBotController extends BotController = BotController> {
slots: string[];
isPattern?: boolean;
cb?: (userCommand: string, botController: TBotController) => void | string;
}
export type ICommand = Record<string, ICommandParam<any>>;
export declare class mmApp {
private static _envVars;
private static _isDevMode;
static userDbController: IDbControllerModel;
static isSaveDb: boolean;
static appType: TAppType | null;
static config: IAppConfig;
static params: IAppParam;
static commands: ICommand;
static setDevMode(isDevMode?: boolean): void;
static get isDevMode(): boolean;
static arrayMerge(array1: object[], array2?: object[]): object;
private static _setTokens;
private static _getEnvVars;
static setConfig(config: IAppConfig): void;
static setParams(params: IAppParam): void;
static addCommand<TBotController extends BotController = BotController>(commandName: string, slots: string[], cb?: ICommandParam<TBotController>['cb'], isPattern?: boolean): void;
static removeCommand(commandName: string): void;
static setIsSaveDb(isSaveDb?: boolean): void;
static saveData(dir: IDir, data: string, mode?: string): boolean;
static saveJson(fileName: string, data: any): boolean;
static saveLog(fileName: string, errorText?: string | null): boolean;
}