Skip to content

vtkcom/gm-pagination

Repository files navigation

Pagination for Grammy Menu

Usage example

import { Menu } from "@grammyjs/menu";
import { usePagination } from "@vtkcom/gm-pagination";

const menu = new Menu<Context>("menu", { onMenuOutdated: false });

menu
	.dynamic(
		usePagination(async (ctx) => {
			const list = [0,1,2,3,4,5,6,7,8,9]

			return list.map((a, i) => ({
				text: a,
				payload: `id:${i}`,
				callback: fn(a),
			}));
		}, 5)
	)

export { menu };