0.13.5 • Published 6 months ago

@types/tgfancy v0.13.5

Weekly downloads
11
License
MIT
Repository
github
Last release
6 months ago

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.

0.13.3

8 months ago

0.13.4

7 months ago

0.13.5

6 months ago

0.13.2

3 years ago

0.13.1

6 years ago

0.13.0

6 years ago