电报机器人是否可以从频道获取消息?
Is it possible for telegram bot to get messages from channel?
我以管理员身份将机器人添加到频道,但 bot.on('message'
回调中没有消息。我对组添加机器人隐私禁用没有问题。如何获取即将到来的频道消息?
const TelegramBot = require('node-telegram-bot-api');
let bot = new TelegramBot('xxxxxxxxxxxxxxxxxx', {polling: true});
bot.on('message', (msg) => {
console.log(`${msg.from.username}: ${msg.text} ${msg.location}`);
});
如您在 documentation 中所见,更新的正确属性是 "channel_post" 而不是 "message"
我以管理员身份将机器人添加到频道,但 bot.on('message'
回调中没有消息。我对组添加机器人隐私禁用没有问题。如何获取即将到来的频道消息?
const TelegramBot = require('node-telegram-bot-api');
let bot = new TelegramBot('xxxxxxxxxxxxxxxxxx', {polling: true});
bot.on('message', (msg) => {
console.log(`${msg.from.username}: ${msg.text} ${msg.location}`);
});
如您在 documentation 中所见,更新的正确属性是 "channel_post" 而不是 "message"