@types/tgfancy
    TypeScript icon, indicating that this package has built-in type declarations

    0.13.2 • Public • Published

    Installation

    npm install --save @types/tgfancy

    Summary

    This package contains type definitions for tgfancy (https://github.com/GochoMugo/tgfancy).

    Details

    Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tgfancy.

    index.d.ts

    // Type definitions for tgfancy 0.13
    // Project: https://github.com/GochoMugo/tgfancy
    // Definitions by: Giorgio Garasto <https://github.com/Dabolus>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
    // TypeScript Version: 2.3
    
    import * as TelegramBot from 'node-telegram-bot-api';
    
    declare namespace Tgfancy {
        interface ChatIdResolutionOptions {
            resolve(token: string, chatId: number | string, callback: ((error: Error | null, target: any) => void)): void;
        }
    
        interface EmojificationOptions {
            emojify(text: string): string;
        }
    
        interface RatelimitingOptions {
            maxRetries?: number | undefined;
            timeout?: number | undefined;
            notify?(methodName: string, ...args: any[]): void;
            maxBackoff?: number | undefined;
        }
    
        interface WebSocketOptions {
            url: string;
            autoOpen?: boolean | undefined;
        }
    
        interface TgfancyOptions {
            chatIdResolution?: boolean | ChatIdResolutionOptions | undefined;
            emojification?: boolean | EmojificationOptions | undefined;
            kickWithoutBan?: boolean | undefined;
            openshiftWebHook?: boolean | undefined;
            orderedSending?: boolean | undefined;
            ratelimiting?: boolean | RatelimitingOptions | undefined;
            textPaging?: boolean | undefined;
            webSocket?: boolean | WebSocketOptions | undefined;
        }
    
        interface ConstructorOptions extends TelegramBot.ConstructorOptions {
            tgfancy?: TgfancyOptions | undefined;
        }
    
        interface ResolvedChat {
            id: number | string;
            username: string;
            type: string;
            when: string;
        }
    
        interface ResolvedGroupOrChannel extends ResolvedChat {
            title: string;
        }
    
        interface ResolvedUser extends ResolvedChat {
            first_name: string;
            last_name?: string | undefined;
        }
    }
    
    declare class Tgfancy extends TelegramBot {
        constructor(token: string, options?: Tgfancy.ConstructorOptions);
    
        resolveChatId(chatId: string): Promise<Tgfancy.ResolvedChat>;
    
        openWebSocket(): Promise<undefined>;
    
        closeWebSocket(): Promise<undefined>;
    
        hasOpenWebSocket(): boolean;
    
        kickChatMember(chatId: number | string, userId: number | string, ban?: boolean): Promise<boolean>;
    }
    
    export = Tgfancy;

    Additional Details

    Credits

    These definitions were written by Giorgio Garasto.

    Keywords

    none

    Install

    npm i @types/tgfancy

    DownloadsWeekly Downloads

    17

    Version

    0.13.2

    License

    MIT

    Unpacked Size

    7.26 kB

    Total Files

    4

    Last publish

    Collaborators

    • types