umbot
Version:
Universal bot(vk, telegram, viber) or skills for Yandex.Alisa, Маруся and sber
21 lines (20 loc) • 1.41 kB
TypeScript
import { Request } from './request/Request';
import { ITelegramParams, ITelegramResult, TTelegramChatId } from './interfaces';
export declare class TelegramRequest {
readonly API_ENDPOINT = "https://api.telegram.org/bot";
protected _request: Request;
protected _error: string | null | undefined;
token: string | null;
constructor();
initToken(token: string | null): void;
protected _getUrl(): string;
protected _initPostFile(type: string, file: string): void;
call(method: string, userId?: TTelegramChatId | null): Promise<ITelegramResult | null>;
sendMessage(chatId: TTelegramChatId, message: string, params?: ITelegramParams | null): Promise<ITelegramResult | null>;
sendPoll(chatId: TTelegramChatId, question: string, options: string[], params?: ITelegramParams | null): Promise<ITelegramResult | null> | null;
sendPhoto(userId: TTelegramChatId, file: string, desc?: string | null, params?: ITelegramParams | null): Promise<ITelegramResult | null>;
sendDocument(userId: TTelegramChatId, file: string, params?: ITelegramParams | null): Promise<ITelegramResult | null>;
sendAudio(userId: TTelegramChatId, file: string, params?: ITelegramParams | null): Promise<ITelegramResult | null>;
sendVideo(userId: TTelegramChatId, file: string, params?: ITelegramParams | null): Promise<ITelegramResult | null>;
protected _log(error?: string): void;
}