How can I send ordered data from an array to Telegram Bot?
For example, I have text1, text2, text3in the array, but it sends them as text3, text1, text2, why not in the original order.
This is my code:
function sendAllText(msg, opts) {
if (locale.keyboards[msg.text].text) {
var i,j,tempstring;
for (i=0,j=locale.keyboards[msg.text].text.length; i<j; i++) {
tempstring = locale.keyboards[msg.text].text[i];
bot.sendMessage(msg.chat.id, tempstring, opts);
}
}
}
The function is called as follows:
sendAllText(msg, opts);
source
share