我正在尝试制作发送图像的电报机器人,用户可以按名称选择图像,但不起作用
`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 }`);
});
`