无法使用Node-telegram-bot-api发送照片

时间:2019-10-23 17:50:20

标签: node.js telegram-bot

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");
  } 
});

0 个答案:

没有答案