This repository was archived by the owner on Jun 13, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,13 +104,25 @@ def bot_quick_delete(message):
104104@bot .callback_query_handler (func = lambda call : True )
105105def test_callback (call ):
106106 previous = call .data
107- markup = types .InlineKeyboardMarkup (2 )
107+ btn_list = []
108+ size = 3
109+ markup = types .InlineKeyboardMarkup (size )
110+
108111 if len (call .data .split (' ' )) == 2 :
109112 episode_count , _ = yyets .get_episode_count (call .data )
113+
110114 for button in range (1 , episode_count + 1 ):
111- markup .add (types .InlineKeyboardButton ("第%s集" % button , callback_data = '%s %s' % (previous , button )))
112- bot .edit_message_text ('那么看第几集好呢😘' , chat_id = call .message .chat .id , message_id = call .message .message_id )
115+ btn_list .append (types .InlineKeyboardButton ("第%s集" % button , callback_data = '%s %s' % (previous , button )))
116+ for i in range (0 , len (btn_list ), size ):
117+ part = btn_list [i :i + size ]
118+ if len (part ) == 3 :
119+ markup .add (part [0 ], part [1 ], part [2 ])
120+ elif len (part ) == 2 :
121+ markup .add (part [0 ], part [1 ])
122+ else :
123+ markup .add (part [0 ])
113124
125+ bot .edit_message_text ('那么看第几集好呢😘' , chat_id = call .message .chat .id , message_id = call .message .message_id )
114126 bot .edit_message_reply_markup (call .message .chat .id , call .message .message_id , reply_markup = markup )
115127
116128 else :
You can’t perform that action at this time.
0 commit comments