0.3.2 • Published 9 months ago

@telegum/tgx v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

npm downloads license coverage

Implementation of jsx-runtime to create Telegram messages using JSX.

Installation

npm i @telegum/tgx

Then in your tsconfig.json:

{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "@telegum/tgx",
    // ...
  }
}

Example

Usage with grammY:

import { html } from '@telegum/tgx'
import { Bot } from 'grammy'

const Greeting = (props: { name: string }) => (
  <>Hello, <b>{props.name}</b>!</>
)

const bot = new Bot(/* TOKEN */)

bot.command('start', async (ctx) => {
  await ctx.reply(
    html(<Greeting name={ctx.from.first_name} />),
    { parse_mode: 'HTML' }
  )
})

bot.start()

License

MIT

0.3.0

9 months ago

0.3.2

9 months ago

0.3.1

9 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago