在电报机器人中,与nodejs,我想发送照片,然后将消息发送给用户
我使用此代码:
bot.sendPhoto(chatId, photo);
bot.sendMessage(chatId, caption, opts);
但我的问题是:消息显示在照片上方,而照片和嵌入式按钮则显示在照片上方:(我喜欢显示的第一张照片,其后的消息带有嵌入式按钮
我用这个:
bot.sendPhoto(chatId, photo, function(){bot.sendMessage(chatId, caption, opts)});
但是显示了此代码照片,但未显示任何消息
请原谅我英语不好!
用诺言。您可以使用q库来实现。
确保sendPhoto函数返回一个诺言。这样您就可以执行以下操作
bot.sendPhoto(chatId, photo).then(function(resultFromSendPhoto){
bot.sendMessage(chatId, caption, opts);
//your further code goes here if you want
}).catch(function(error){
console.log(error);
}).done();
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句