无法在 Telegram Bot 中发送对象
Can't send object in Telegram Bot
我正在尝试从机器人向用户发送纯文本以外的任何内容。例如,我想为发送贴纸创建回声。我正在使用 yagop 的 node-telegram-bot-api。
代码:
bot = new TelegramBot(token, {
polling: true
});
bot.on('sticker', function(msg){
bot.sendSticker(msg.chat.id, msg.sticker);
});
我有Error: ETELEGRAM: 400 Bad Request: there is no sticker in the request
。如果我发送的不是纯文本,这会导致每次。
如何处理这个问题?
您需要发送msg.sticker.file_id
而不是msg.sticker
,例如:
我正在尝试从机器人向用户发送纯文本以外的任何内容。例如,我想为发送贴纸创建回声。我正在使用 yagop 的 node-telegram-bot-api。 代码:
bot = new TelegramBot(token, {
polling: true
});
bot.on('sticker', function(msg){
bot.sendSticker(msg.chat.id, msg.sticker);
});
我有Error: ETELEGRAM: 400 Bad Request: there is no sticker in the request
。如果我发送的不是纯文本,这会导致每次。
如何处理这个问题?
您需要发送msg.sticker.file_id
而不是msg.sticker
,例如: