Загрузка...

How to get a message from the user and write that message to a variable

Thread in Node.js created by dentop11 Feb 17, 2023. 167 views

  1. dentop11
    dentop11 Topic starter Feb 17, 2023 0 Jul 12, 2022
    Пишу тг бота на node js с ври node-telegram-bot-api
     
  2. Sensei
    Sensei Feb 17, 2023 332 May 26, 2019
    [IMG]
    const TelegramBot = require('node-telegram-bot-api');



    const token = 'BOT_TOKEN_HERE';

    const bot = new TelegramBot(token, { polling: true });



    bot.on('message', (msg) => {

    const chatId = msg.chat.id;

    const messageText = msg.text;

    console.log(`Received message: "${messageText}" from chat ${chatId}`);

    // Здесь можно обработать сообщение и выполнить нужные действия

    });
     
    1. Sensei
      Sensei, ChatGPT в помощь
      Он вообще полностью может написать тебе бота, только постепенно, не 1 запросом
  3. dentop11
    dentop11 Topic starter Feb 17, 2023 0 Jul 12, 2022
    Понял, спасибо
     
Loading...
Top