节点电报机器人未发送用户想要的图像

时间:2019-01-25 21:42:38

标签: node.js telegram telegram-bot

我正在尝试制作发送图像的电报机器人,用户可以按名称选择图像,但不起作用

`const TelegramBot = require('node-telegram-bot-api');
const ogs = require('open-graph-scraper');
const token = '643829324:AAEPZKaeAdib3CTU3Fz9gETzTkQ0YQg9Ta0';
const bot = new TelegramBot(token, {polling: true});
var express = require('express')
var app = express()
var bodyParser = require('body-parser')
const axios = require('axios')

app.use(bodyParser.json()) // for parsing application/json
app.use(
  bodyParser.urlencoded({
    extended: true
  })
)

bot.on('message', (msg, match) => {
  const chatId = msg.chat.id;
  const resp = match[0];
  // send a message to the chat acknowledging receipt of their message
  bot.sendPhoto(chatId, resp + ".jpg");
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
    console.log(`Our app is running on port ${ PORT }`);
});

`

0 个答案:

没有答案