I'm a total beginner, I have a question: I'm going to create a telegram bot using botogram, I would like to insert my list's element in a JSON code by python loop. In this case I would like to create buttons with New York, LA, and Washington, {'text': i}
, but on telegram appears just one button with the last item (Washington). I want to create 3 buttons.
import botogram
import json
bot = botogram.create("token")
list = ['New York',"LA", "Washington DC"]
@bot.command("start")
def start_command(chat, message):
for i in list:
bot.api.call('sendMessage', {
'chat_id': chat.id,
'text': 'Where are you?',
'reply_markup': json.dumps({
'keyboard': [
[
{'text': i},
{'text': 'Action B'},
],
[
{
'text': 'Use geolocation',
'request_location': True,
},
],
],
'resize_keyboard': True,
'one_time_keyboard': True,
'selective': True,
}),
})
if __name__ == "__main__":
bot.run()