14 lines
457 B
JavaScript
14 lines
457 B
JavaScript
const { Bot } = require('grammy');
|
||
|
||
// Токен берётся из переменной окружения BOT_TOKEN (файл .env)
|
||
const bot = new Bot(process.env.BOT_TOKEN);
|
||
|
||
bot.command('start', (ctx) => ctx.reply('Привет! Я бот. Напиши мне что-нибудь.'));
|
||
|
||
bot.on('message:text', (ctx) => {
|
||
ctx.reply('Ты написал: ' + ctx.message.text);
|
||
});
|
||
|
||
bot.start();
|
||
console.log('Бот запущен (long‑polling)');
|