0.0.1 • Published 10 months ago

tg-html v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

tg-html

JSX bindings, for use with Telegram bots.

See the Telegram Bot API documentation for the HTML formatting spec.

Setup

Configure your .tsconfig.json with the following properties:

{
    "compilerOptions": [
        "jsx": "react",
        "jsxFactory": "tgHtml.createElement",
        "jsxFragmentFactory": "tgHtml.createFragment"
    ]
}

Then, write JSX components like this:

import * as tgHtml from 'tg-html';

export function Greeting({
    username,
}: Readonly<{
    username: string;
}>): JSX.Element {
    return (
        <>
            <b><i>My Telegram Bot</i></b>\n
            \n
            Welcome, {username}!
        </>
    );
}

Thanks

0.0.1

10 months ago