Skip to content

Commit ce8a077

Browse files
committed
优化按钮回调数据,简化为仅使用索引值
1 parent d5f63bc commit ce8a077

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/chain/message.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -742,15 +742,15 @@ def _create_media_buttons(self, channel: MessageChannel, items: list, total: int
742742

743743
buttons.append([{
744744
"text": button_text,
745-
"callback_data": f"select_{_current_page * self._page_size + i}"
745+
"callback_data": f"select_{i}"
746746
}])
747747
else:
748748
# 多按钮一行的情况,使用简化文本
749749
button_text = f"{i + 1}"
750750

751751
current_row.append({
752752
"text": button_text,
753-
"callback_data": f"select_{_current_page * self._page_size + i}"
753+
"callback_data": f"select_{i}"
754754
})
755755

756756
# 如果当前行已满或者是最后一个按钮,添加到按钮列表
@@ -837,15 +837,15 @@ def _create_torrent_buttons(self, channel: MessageChannel, items: list, total: i
837837

838838
buttons.append([{
839839
"text": button_text,
840-
"callback_data": f"download_{_current_page * self._page_size + i}"
840+
"callback_data": f"download_{i}"
841841
}])
842842
else:
843843
# 多按钮一行的情况,使用简化文本
844844
button_text = f"{i + 1}"
845845

846846
current_row.append({
847847
"text": button_text,
848-
"callback_data": f"download_{_current_page * self._page_size + i}"
848+
"callback_data": f"download_{i}"
849849
})
850850

851851
# 如果当前行已满或者是最后一个按钮,添加到按钮列表

0 commit comments

Comments
 (0)