mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-10 16:12:22 +03:00
Let lists of buttons make up rows
This commit is contained in:
parent
ad7e62baf3
commit
ad37db1cd6
|
@ -53,7 +53,7 @@ class ButtonMethods(UpdateMethods):
|
||||||
if not utils.is_list_like(buttons):
|
if not utils.is_list_like(buttons):
|
||||||
buttons = [[buttons]]
|
buttons = [[buttons]]
|
||||||
elif not utils.is_list_like(buttons[0]):
|
elif not utils.is_list_like(buttons[0]):
|
||||||
buttons = [buttons]
|
buttons = [[b] for b in buttons]
|
||||||
|
|
||||||
is_inline = False
|
is_inline = False
|
||||||
is_normal = False
|
is_normal = False
|
||||||
|
|
|
@ -636,6 +636,14 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods):
|
||||||
client.send_message(chat, 'A single button, with "clk1" as data',
|
client.send_message(chat, 'A single button, with "clk1" as data',
|
||||||
buttons=Button.inline('Click me', b'clk1'))
|
buttons=Button.inline('Click me', b'clk1'))
|
||||||
|
|
||||||
|
# Row of inline buttons (just a list)
|
||||||
|
client.send_message(chat, 'Look at this row',
|
||||||
|
[Button.inline('Row 1'), Button.inline('Row 2')])
|
||||||
|
|
||||||
|
# Columns of inline buttons (a list of lists)
|
||||||
|
client.send_message(chat, 'Look at this row',
|
||||||
|
[[Button.inline('Col 1'), Button.inline('Col 2')]])
|
||||||
|
|
||||||
# Matrix of inline buttons
|
# Matrix of inline buttons
|
||||||
client.send_message(chat, 'Pick one from this grid', buttons=[
|
client.send_message(chat, 'Pick one from this grid', buttons=[
|
||||||
[Button.inline('Left'), Button.inline('Right')],
|
[Button.inline('Left'), Button.inline('Right')],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user