Compile the TypeScript app
For a project with src/index.ts, configure TypeScript to produce dist/index.js. Keep telegraf in dependencies so the production install includes it. Match the emitted module format to package.json. With a NodeNext build and "type": "module", use ESM imports in your source.
Run your project’s build locally. Upload the dist directory, package.json, and the lockfile to a Node.js 폴링 봇 deployment from Telegram 봇 호스팅.
Run the built entry file
Set MAIN_FILE → dist/index.js and store TELEGRAM_BOT_TOKEN in Variables. Bring up the hosted copy only after stopping the old poller. An example entry using signals supported by the Telegraf polling runner looks like this.
import { Telegraf } from 'telegraf';
const token = process.env.TELEGRAM_BOT_TOKEN;
if (!token) throw new Error('Set TELEGRAM_BOT_TOKEN in Variables');
const bot = new Telegraf(token);
bot.command('release', (ctx) => ctx.reply('Telegraf build is running'));
process.once('SIGINT', () => bot.stop('SIGINT'));
process.once('SIGTERM', () => bot.stop('SIGTERM'));
await bot.launch();Check the release that is actually running
보내기 /release in a private chat. Change the response locally, rebuild, upload the new output and restart the worker. If the reply still has the old text, check that the entry file points to the uploaded output and the same bot token is saved.
A module-not-found error before polling usually points to an omitted dependency, wrong build path or inconsistent module format. Check Console before changing any Telegram settings. Telegraf startup and shutdown examples.