const TelegramBot = require('node-telegram-bot-api'); require('dotenv').config() const axios = require('axios') const tokenTg = process.env.TOKEN_TG; const tokenAi = process.env.TOKEN_AI; const accessId = process.env.SECRET_ID; const bot = new TelegramBot(tokenTg, { polling: true }); console.log('Бот запущен...'); bot.onText(/\/info/, (msg)=>{ const message = `Информация о боте: \n '/start' - перезапускает чат, забывает контекст прошлого диалого \n '/toggleModel' - Выбор модели (еще не доступен)` const chatId = msg.chat.id bot.sendMessage(chatId, message) }) bot.onText(/\/start/, (msg) => { const chatId = msg.chat.id; const chatType = msg.chat.type bot.sendMessage(chatId, `Чат перезапущен, тип чата ${chatType}`); }); bot.on('message', (msg) => { const chatId = msg.chat.id; const user = msg.from if (msg.text && msg.text.startsWith('/')) { return; } if (msg.photo) { bot.sendMessage(chatId, 'Красиво, но такое мне не надо'); return; } if (msg.document) { bot.sendMessage(chatId, 'Такое мне не надо'); return; } if (msg.text) { bot.sendMessage(chatId, `Ты написал: ${msg.text}`); return; } });