telegram-jsx
v1.3.1
Published
TSX/JSX runtime for telegram bots
Downloads
101
Maintainers
Readme
Telegram JSX
TSX/JSX runtime for telegram bots
Installation
- Run:
npm install telegram-jsx
- Set these properties in
tsconfig.json
{ "jsx": "react-jsx", "jsxImportSource": "telegram-jsx", "include": ["node_modules/telegram-jsx/index.d.ts"] }
Usage
Now you can create components and use TSX
import { Paragraph } from "telegram-jsx";
export function Ul({ children }: { children: Iterable<JSX.Child> }) {
return (
<>
{[...children].filter(Boolean).map((value) => (
<Paragraph>
<i>•</i> {value}
</Paragraph>
))}
</>
);
}
telegram.updates.on("message", (context) =>
context.reply((<b>yoo!</b>).toString())
);