const TelegramBot = require('node-telegram-bot-api'); const axios = require('axios'); const telegramToken = '6935550366:AAFCn08aHQFBQxjQSfYCnbyxyzc5mZCKg9I'; const cloudflareToken = 'NB-sxyNA3JSyhezy2fUnTnXc3Pf7i8X17BJfBwLx'; const bot = new TelegramBot(telegramToken, {polling: true}); console.log('Load bot success..') console.log('Can use!') bot.on('message', (msg) => { const chatId = msg.chat.id; const userMessage = msg.text; axios.post('https://api.cloudflare.com/client/v4/accounts/d888e02cee618e93b19cd9e7717da715/ai/run/@cf/mistral/mistral-7b-instruct-v0.1', { prompt: userMessage }, { headers: { 'Authorization': `Bearer ${cloudflareToken}` } }).then(response => { const aiResponse = response.data.result.response; bot.sendMessage(chatId, aiResponse); }).catch(error => { bot.sendMessage(chatId, 'Something wrong please send again message!'); console.error(error); }); });