Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alexxandergrib/telegram-jsx

TSX/JSX runtime for telegram bots
https://github.com/alexxandergrib/telegram-jsx

bot components formatting jsx telegram tsx

Last synced: about 2 months ago
JSON representation

TSX/JSX runtime for telegram bots

Awesome Lists containing this project

README

        

# Telegram JSX

TSX/JSX runtime for telegram bots

## Installation

1. Run:
```bash
npm install telegram-jsx
```
2. Set these properties in `tsconfig.json`
```json
{
"jsx": "react-jsx",
"jsxImportSource": "telegram-jsx",
"include": ["node_modules/telegram-jsx/index.d.ts"]
}
```

## Usage

Now you can create components and use TSX

```tsx
import { Paragraph } from "telegram-jsx";

export function Ul({ children }: { children: Iterable }) {
return (
<>
{[...children].filter(Boolean).map((value) => (

{value}

))}
>
);
}
```

```tsx
telegram.updates.on("message", (context) =>
context.reply((yoo!).toString())
);
```