Skip to main content

One post tagged with "jsx"

View All Tags

· One min read
Vitali Haradkou

The new telegraph component was landed and available on npm.js site.

analytics​

This components listen any chat iteraction with user and emits events with analytics prefix.

Analytics components also defines PluginAPI to write a custom extensions for analytics. See docs how to work with plugins.

Installation:

npm i @tlgr/analytics

How it works:

example.ts
import { Analytics } from "@tlgr/analytics";
import { Console } from "@tlgr/analytics/plugins";
import { Telegraf } from "telegraf";

const bot = new Telegraf("<API TOKEN>");

const analytics = new Analytics(bot, new Console());

analytics.enable(true); // true - launch imidiately
bot.start((ctx) => {
// send message
ctx.reply(/** reply message */);
});

// fires event with start command, and reply text as param.

JSX support for fmt package.​

For now, when you want to reply message, you can use JSX markup. See docs how to enable JSX support

Full Changelog available at link: https://github.com/vitalics/Telegraph/blob/main/releases/v1.4.0.md