UNPKG

@gramio/format

Version:

Library for formatting text for Telegram Bot API

24 lines (21 loc) 1.02 kB
import { TelegramMessageEntity } from '@gramio/types'; /** Type which contains a string or has the ability to result in a string object */ type Stringable = string | { toString(): string; }; /** Class-helper for work with formattable [entities](https://core.telegram.org/bots/api#messageentity) */ declare class FormattableString { /** Text of FormattableString (auto covert to it if entities is unsupported)*/ text: string; /** Entities of FormattableString */ entities: TelegramMessageEntity[]; /** Create new FormattableString */ constructor(text: string, entities: TelegramMessageEntity[]); /** Create new FormattableString */ static from(text: string, entities: TelegramMessageEntity[]): FormattableString; toString(): string; toJSON(): string; static [Symbol.hasInstance](value: unknown): value is FormattableString; } declare function getFormattable(str: Stringable): FormattableString; export { FormattableString as F, type Stringable as S, getFormattable as g };