aiogram-inline-paginations icon indicating copy to clipboard operation
aiogram-inline-paginations copied to clipboard

The "next" buttons in Paginator are not responding

Open triplenick opened this issue 2 years ago • 5 comments

I'm using aigoram stable version 2.25.1, so I installed aiogram-inline-paginations 0.1.9, instead of latest versions.

I iterate over a list of documents retrieved from the Firebase database.

@dp.callback_query_handler(lambda c: c.data == "orders_list")
async def fresh_orders_manager(callback_query):
    if callback_query.from_user.id in managers:

        # Connecting to the Firebase collection
        fresh_orders_ref = db.collection("orders")

	# Querying the required values to get the list of documents
	fresh_orders = fresh_orders_ref.where("status", "==", 0).get()

	# If at least one document is found
        if fresh_orders:
            # Iterate through the documents
            markup = types.InlineKeyboardMarkup()

            for fresh_order in fresh_orders:
                order_time = fresh_order.get('orderTime')
                order_time = addons.time_dd_mm_hh_mm(order_time)

                button_text = f'✳️ {order_time} | {fresh_order.get("name")} — @{fresh_order.get("telegram")}'
                button = types.InlineKeyboardButton(text=button_text,
                                                    callback_data=f'manager_vieworder_{fresh_order.id}')
                markup.add(button)

	    # Implementing Paginator
            paginator = Paginator(data=markup, size=5)
            await bot.send_message(chat_id=callback_query.message.chat.id,
                                   text="*Orders List*",
                                   reply_markup=paginator(),
                                   parse_mode='Markdown')

        else:
            # If no documents are found
            await bot.send_message(chat_id=callback_query.from_user.id,
                                   text=f"There are no new orders.")

In general, it results in page switching buttons do not respond. No console errors as well.

Should I merge to the new aiogram version? Or that's not actually the reason?

img

triplenick avatar Feb 09 '23 06:02 triplenick

Hello, please try Paginator(dp=dp)

daniilshamraev avatar Feb 09 '23 08:02 daniilshamraev

paginator = Paginator(data=markup, size=5, dp=dp)

@daniilshamraev Unfortunately, it doesn't make any sense :(

triplenick avatar Feb 09 '23 12:02 triplenick

In this case, wait for the update of the library, soon I will completely rework it, taking into account my new experience in development

daniilshamraev avatar Feb 11 '23 12:02 daniilshamraev

Thank you for your contribution! I'm excited to see this. Will the new version be compatible with aiogram 2.x?

UPD: nevermind :) just read your comment in another issue. Wish you good luck with that!

triplenick avatar Feb 12 '23 08:02 triplenick

triplenick, у меня было абсолютно точно также. В консоли нашел ошибку, которая указывала на pagination.py ---> _list_current_page = self._list_kb[current_page] IndexError: list index out of range

maximhouston avatar Feb 16 '23 09:02 maximhouston