From 8900bb775fa5153368cf68277b3efa8b59535959 Mon Sep 17 00:00:00 2001 From: PyMaster <59120866+pystorage@users.noreply.github.com> Date: Wed, 30 Dec 2020 19:01:05 +0300 Subject: [PATCH] Add files via upload --- README.md | 239 ++++++++++++++++++++++------------------------- requirements.txt | 4 +- setup.py | 2 +- 3 files changed, 117 insertions(+), 128 deletions(-) diff --git a/README.md b/README.md index 480a6c8..c8c5e6a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

-Pykeyboard +pykeyboard

![PyPI](https://img.shields.io/pypi/v/pykeyboard) @@ -9,27 +9,31 @@
-## Installation +# What's new? + +- Added a new method to InlineKeyboard for working with pagination. The InlinePaginationKeyboard class will be removed in a future version. + +# Installation ```shell pip install pykeyboard ``` -## Documentation +# Documentation -### Inline Keyboard +## Inline Keyboard ```python from pykeyboard import InlineKeyboard ``` -#### Parameters: +##### Parameters: - row_width (integer, default 3) -#### Inline Keyboard add buttons +### Inline Keyboard add buttons -##### Code +#### Code ```python from pykeyboard import InlineKeyboard @@ -48,13 +52,13 @@ keyboard.add( ) ``` -##### Result +#### Result

add_inline_button

-#### Inline Keyboard row buttons +### Inline Keyboard row buttons -##### Code +#### Code ```python from pykeyboard import InlineKeyboard @@ -74,11 +78,103 @@ keyboard.row( ) ``` -##### Result +#### Result

row_inline_button

-### Reply Keyboard +### Pagination inline keyboard + +```python +from pykeyboard import InlineKeyboard +``` + +#### Parameters: + +- count_pages (integer) +- current_page (integer) +- callback_pattern (string) - use of the `{number}` pattern is required + +#### Pagination 3 pages + +#### Code + +```python +from pykeyboard import InlineKeyboard + +keyboard = InlineKeyboard() +keyboard.paginate(3, 3, 'pagination_keyboard#{number}') +``` + +#### Result + +

pagination_keyboard_3

+ +#### Pagination 5 pages + +#### Code + +```python +from pykeyboard import InlineKeyboard + +keyboard = InlineKeyboard() +keyboard.paginate(5, 3, 'pagination_keyboard#{number}') +``` + +#### Result + +

pagination_keyboard_5

+ +#### Pagination 9 pages + +#### Code + +```python +from pykeyboard import InlineKeyboard + +keyboard = InlineKeyboard() +keyboard.paginate(9, 5, 'pagination_keyboard#{number}') +``` + +#### Result + +

pagination_keyboard_9

+ +#### Pagination 100 pages + +#### Code + +```python +from pykeyboard import InlineKeyboard + +keyboard = InlineKeyboard() +keyboard.paginate(100, 100, 'pagination_keyboard#{number}') +``` + +#### Result + +

pagination_keyboard_100

+ +#### Pagination 150 pages and buttons + +#### Code + +```python +from pykeyboard import InlineKeyboard +from pyrogram.types import InlineKeyboardButton + +keyboard = InlineKeyboard() +keyboard.paginate(150, 123, 'pagination_keyboard#{number}') +keyboard.row( + InlineKeyboardButton('Back', 'pagination_keyboard#back'), + InlineKeyboardButton('Close', 'pagination_keyboard#close') +) +``` + +#### Result + +

pagination_keyboard_150

+ +## Reply Keyboard ```python from pykeyboard import ReplyKeyboard @@ -91,9 +187,9 @@ from pykeyboard import ReplyKeyboard - selective (bool, optional) - row_width (integer, default 3) -#### Reply Keyboard add buttons +### Reply Keyboard add buttons -##### Code +#### Code ```python from pykeyboard import ReplyKeyboard @@ -110,13 +206,13 @@ keyboard.add( ) ``` -##### Result +#### Result

add_reply_button

-#### Reply Keyboard row buttons +### Reply Keyboard row buttons -##### Code +#### Code ```python from pykeyboard import ReplyKeyboard @@ -133,113 +229,6 @@ keyboard.row(KeyboardButton('4', 'reply_keyboard#4')) keyboard.row(KeyboardButton('5', 'reply_keyboard#5')) ``` -##### Result +#### Result

row_reply_button

- -### Pagination inline keyboard - -```python -from pykeyboard import InlinePaginationKeyboard -``` - -#### Parameters: - -- count_pages (integer) -- current_page (integer) -- callback_pattern (string) - use of the `{number}` pattern is required - -#### Pagination 3 pages - -##### Code - -```python -from pykeyboard import InlinePaginationKeyboard - - -keyboard = InlinePaginationKeyboard(3, 3, 'pagination_keyboard#{number}') -``` - -##### Result - -

pagination_keyboard_3

- -#### Pagination 5 pages - -##### Code - -```python -from pykeyboard import InlinePaginationKeyboard - - -keyboard = InlinePaginationKeyboard(5, 3, 'pagination_keyboard#{number}') -``` - -##### Result - -

pagination_keyboard_5

- -#### Pagination 9 pages - -##### Code - -```python -from pykeyboard import InlinePaginationKeyboard - - -keyboard = InlinePaginationKeyboard(9, 5, 'pagination_keyboard#{number}') -``` - -##### Result - -

pagination_keyboard_9

- -#### Pagination 25 pages - -##### Code - -```python -from pykeyboard import InlinePaginationKeyboard - - -keyboard = InlinePaginationKeyboard(25, 14, 'pagination_keyboard#{number}') -``` - -##### Result - -

pagination_keyboard_25

- -#### Pagination 100 pages - -##### Code - -```python -from pykeyboard import InlinePaginationKeyboard - - -keyboard = InlinePaginationKeyboard(100, 100, 'pagination_keyboard#{number}') -``` - -##### Result - -

pagination_keyboard_100

- -#### Pagination 150 pages and buttons - -##### Code - -```python -from pykeyboard import InlinePaginationKeyboard -from pyrogram.types import InlineKeyboardButton - - -keyboard = InlinePaginationKeyboard(150, 123, 'pagination_keyboard#{number}') -keyboard.row( - InlineKeyboardButton('Back', 'pagination_keyboard#back'), - InlineKeyboardButton('Close', 'pagination_keyboard#close') -) -``` - -##### Result - -

pagination_keyboard_150

diff --git a/requirements.txt b/requirements.txt index 057448c..09b7c13 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -Pyrogram==1.0.7 -TgCrypto==1.2.1 \ No newline at end of file +Pyrogram==1.1.1 +TgCrypto==1.2.2 \ No newline at end of file diff --git a/setup.py b/setup.py index afe8f1b..88a662b 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: setup( name='pykeyboard', - version='0.1.1', + version='0.1.2', author='PyMaster', author_email='', description='Best Keyboard and Pagination for the Pyrogram Library.',