Не могу отправить фотографию с помощью node-telegram-bot-api - PullRequest
0 голосов
/ 23 октября 2019
process.env.NTBA_FIX_319 = 1;

const TelegramBot = require('node-telegram-bot-api');


const token = 'mytoken';


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

bot.onText(/\/week (.+)/, (msg, match) => {
  // 'msg' is the received Message from Telegram
  // 'match' is the result of executing the regexp above on the text content
  // of the message

  const chatId = msg.chat.id;
  const resp = match[1]; // the captured "whatever"

  if (resp == "1") {
    bot.sendMessage(chatId, resp);
    bot.on('message', message => {
      message.channel.send("My Bot's message", {files: ["https://i.imgur.com/XxxXxXX.jpg"]});
  });
  } else {
    bot.sendMessage(chatId, "You entered wrong value");
  } 
});
...