P
P
pozner882021-10-11 17:55:41
Python
pozner88, 2021-10-11 17:55:41

How to create a keyboard from a list of users?

Tell me if it is possible to create any keyboard for telegram bot on aiogramm from the list, do not prescribe each button, but do it automatically. If possible then how.
Preferably inline buttons, the list of users is in the database.
Thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Python Newbie, 2021-10-11
@pozner88

You get all users from the database. Then in the loop inside you write the addition of a button with the text of the variable . And after that you send the message with buttons. for user in users:user

I
InternetMaster, 2021-10-11
@InternetMaster

Basically, Python Newbie 's answer is correct. But perhaps (I don’t know for sure) Telegram has a limit on the number of buttons in one message (you can study exactly at https://core.telegram.org/bots ), and for more “beauty” in the answer, it’s better to make a multi-page menu. Especially useful if there are more than 50 users

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question