{{emit_if (not features.typescript)}} {{#if features.dispatcher}} import { Dispatcher, filters } from '@mtcute/dispatcher' {{/if}} {{#if (eq packageManager "bun")}} import { TelegramClient } from '@mtcute/bun' {{else}} import { TelegramClient } from '@mtcute/node' {{/if}} import * as env from './env.js' {{#if features.i18n}} import { tr } from './i18n/index.js' {{/if}} const tg = new TelegramClient({ apiId: env.API_ID, apiHash: env.API_HASH, storage: 'bot-data/session', }) {{#if features.dispatcher}} const dp = Dispatcher.for(tg) dp.onNewMessage(filters.start, async (msg) => { {{#if features.i18n}} await msg.answerText(tr(msg, 'helloWorld')) {{else}} await msg.answerText('Hello, world!') {{/if}} }) {{/if}} tg.run( {{#if botToken}} { botToken: env.BOT_TOKEN }, {{/if}} (user) => { console.log('Logged in as', user.username) }, )