简体   繁体   English

如何在 Telegram bot Nodejs 中显示 [Object]

[英]How to display [Object] in Telegram bot Nodejs

[in Telegram bot it only shows The current price of object object [在 Telegram 机器人中,它只显示object object的当前价格

await bot.sendMessage(chat_id, The current price of ${_coinList}. ); await bot.sendMessage(chat_id, The current price of ${_coinList}. );

Seems like _coinList is an object of some sort.似乎_coinList是某种 object 。 Try to send it as JSON.stringify(_coinList) and see what that object looks like.尝试将其发送为JSON.stringify(_coinList)并查看 object 的样子。

so you should try the following:所以你应该尝试以下方法:

await bot.sendMessage(chat_id, The current price of ${JSON.stringify(_coinList)}.);

From here you should see the structure of the object and choose the correct key in the object.从这里您应该看到 object 的结构并在 object 中选择正确的键。 For example:例如:

await bot.sendMessage(chat_id, The current price of ${_coinList.eth}.);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM