Answer the question
In order to leave comments, you need to log in
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
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
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 questionAsk a Question
731 491 924 answers to any question