
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
A simple library for aiogram 2.25.2 that allows you to easily do pagination for any Inline keyboards.
Install for pip:
pip install aiogram2252-page
from aiogram2252_page.paginator import Paginator
from aiogram import types
kb = types.InlineKeyboardMarkup()
paginator = Paginator(data=kb, size=5)
data: Any ready-to-use keyboard InlineKeyboardMarkup or any iterable object with InlineKeyboardButton.
size: The number of rows of buttons on one page, excluding the navigation bar.
A paginator object that, when called, returns a ready-made keyboard with pagination.
from aiogram2252_page.paginator import Paginator
from aiogram import types
kb = types.InlineKeyboardMarkup()
paginator = Paginator(data=kb, size=5)
@dp.message_handler()
async def some_func(message: types.Message):
await message.answer(
text='Pagination ',
reply_markup=paginator()
)
Data for registrations paginator.
import random
from aiogram import Bot, Dispatcher, types
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from aiogram.dispatcher.filters import CommandStart
from aiogram.utils.executor import Executor
from aiogram2252_page.paginator import Paginator
token = ''
storage = MemoryStorage()
bot = Bot(token=token)
dp = Dispatcher(bot, storage=storage)
@dp.message_handler(CommandStart(), state='*')
async def start(message: types.Message):
await message.answer('Hello world!')
'''row_width - this parameter indicates the number of columns in the pagination'''
kb = types.InlineKeyboardMarkup(row_width=2)
kb.add(
*[
types.InlineKeyboardButton(
text=str(random.randint(1000000, 10000000)),
callback_data='pass'
) for i in range(100)
]
)
'''size is a parameter that indicates the number of rows in a column'''
paginator = Paginator(data=kb, size=5, dp=dp, callback_startswith="page:")
await message.answer(
text='Paginator',
reply_markup=paginator()
)
if __name__ == '__main__':
Executor(dp).start_polling()
First page:
Second page:
Last page:
Clicking on the current page number returns to the first page
The order of entries is not lost.
FAQs
Inline pagination for aiogram 2.25.2
We found that aiogram2252-page demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.