Add files via upload
This commit is contained in:
parent
a9c7322ab4
commit
16e6a1ba67
76
README.md
76
README.md
@ -30,6 +30,7 @@
|
||||
# What's new?
|
||||
|
||||
- Added a new method to <b>InlineKeyboard</b> for working with <ins>pagination</ins>. The <b>InlinePaginationKeyboard</b> class will be removed in a future version.
|
||||
- Overriding the <b>KeyboardButton</b>, <b>ReplyKeyboardRemove</b>, <b>ForceReply</b>, <b>InlineKeyboardButton</b> methods in <b>ReplyButton</b>, <b>ReplyKeyboardRemove</b>, <b>ForceReply</b>, <b>InlineButton</b>.
|
||||
|
||||
# Installation
|
||||
|
||||
@ -54,19 +55,18 @@ from pykeyboard import InlineKeyboard
|
||||
#### Code
|
||||
|
||||
```python
|
||||
from pykeyboard import InlineKeyboard
|
||||
from pyrogram.types import InlineKeyboardButton
|
||||
from pykeyboard import InlineKeyboard, InlineButton
|
||||
|
||||
|
||||
keyboard = InlineKeyboard(row_width=3)
|
||||
keyboard.add(
|
||||
InlineKeyboardButton('1', 'inline_keyboard#1'),
|
||||
InlineKeyboardButton('2', 'inline_keyboard#2'),
|
||||
InlineKeyboardButton('3', 'inline_keyboard#3'),
|
||||
InlineKeyboardButton('4', 'inline_keyboard#4'),
|
||||
InlineKeyboardButton('5', 'inline_keyboard#5'),
|
||||
InlineKeyboardButton('6', 'inline_keyboard#6'),
|
||||
InlineKeyboardButton('7', 'inline_keyboard#7')
|
||||
InlineButton('1', 'inline_keyboard:1'),
|
||||
InlineButton('2', 'inline_keyboard:2'),
|
||||
InlineButton('3', 'inline_keyboard:3'),
|
||||
InlineButton('4', 'inline_keyboard:4'),
|
||||
InlineButton('5', 'inline_keyboard:5'),
|
||||
InlineButton('6', 'inline_keyboard:6'),
|
||||
InlineButton('7', 'inline_keyboard:7')
|
||||
)
|
||||
```
|
||||
|
||||
@ -79,20 +79,19 @@ keyboard.add(
|
||||
#### Code
|
||||
|
||||
```python
|
||||
from pykeyboard import InlineKeyboard
|
||||
from pyrogram.types import InlineKeyboardButton
|
||||
from pykeyboard import InlineKeyboard, InlineButton
|
||||
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.row(InlineKeyboardButton('1', 'inline_keyboard#1'))
|
||||
keyboard.row(InlineButton('1', 'inline_keyboard:1'))
|
||||
keyboard.row(
|
||||
InlineKeyboardButton('2', 'inline_keyboard#2'),
|
||||
InlineKeyboardButton('3', 'inline_keyboard#3')
|
||||
InlineButton('2', 'inline_keyboard:2'),
|
||||
InlineButton('3', 'inline_keyboard:3')
|
||||
)
|
||||
keyboard.row(InlineKeyboardButton('4', 'inline_keyboard#4'))
|
||||
keyboard.row(InlineButton('4', 'inline_keyboard:4'))
|
||||
keyboard.row(
|
||||
InlineKeyboardButton('5', 'inline_keyboard#5'),
|
||||
InlineKeyboardButton('6', 'inline_keyboard#6')
|
||||
InlineButton('5', 'inline_keyboard:5'),
|
||||
InlineButton('6', 'inline_keyboard:6')
|
||||
)
|
||||
```
|
||||
|
||||
@ -120,7 +119,7 @@ from pykeyboard import InlineKeyboard
|
||||
from pykeyboard import InlineKeyboard
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(3, 3, 'pagination_keyboard#{number}')
|
||||
keyboard.paginate(3, 3, 'pagination_keyboard:{number}')
|
||||
```
|
||||
|
||||
#### Result
|
||||
@ -135,7 +134,7 @@ keyboard.paginate(3, 3, 'pagination_keyboard#{number}')
|
||||
from pykeyboard import InlineKeyboard
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(5, 3, 'pagination_keyboard#{number}')
|
||||
keyboard.paginate(5, 3, 'pagination_keyboard:{number}')
|
||||
```
|
||||
|
||||
#### Result
|
||||
@ -150,7 +149,7 @@ keyboard.paginate(5, 3, 'pagination_keyboard#{number}')
|
||||
from pykeyboard import InlineKeyboard
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(9, 5, 'pagination_keyboard#{number}')
|
||||
keyboard.paginate(9, 5, 'pagination_keyboard:{number}')
|
||||
```
|
||||
|
||||
#### Result
|
||||
@ -165,7 +164,7 @@ keyboard.paginate(9, 5, 'pagination_keyboard#{number}')
|
||||
from pykeyboard import InlineKeyboard
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(100, 100, 'pagination_keyboard#{number}')
|
||||
keyboard.paginate(100, 100, 'pagination_keyboard:{number}')
|
||||
```
|
||||
|
||||
#### Result
|
||||
@ -177,14 +176,13 @@ keyboard.paginate(100, 100, 'pagination_keyboard#{number}')
|
||||
#### Code
|
||||
|
||||
```python
|
||||
from pykeyboard import InlineKeyboard
|
||||
from pyrogram.types import InlineKeyboardButton
|
||||
from pykeyboard import InlineKeyboard, InlineButton
|
||||
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.paginate(150, 123, 'pagination_keyboard#{number}')
|
||||
keyboard.paginate(150, 123, 'pagination_keyboard:{number}')
|
||||
keyboard.row(
|
||||
InlineKeyboardButton('Back', 'pagination_keyboard#back'),
|
||||
InlineKeyboardButton('Close', 'pagination_keyboard#close')
|
||||
InlineButton('Back', 'pagination_keyboard:back'),
|
||||
InlineButton('Close', 'pagination_keyboard:close')
|
||||
)
|
||||
```
|
||||
|
||||
@ -210,17 +208,16 @@ from pykeyboard import ReplyKeyboard
|
||||
#### Code
|
||||
|
||||
```python
|
||||
from pykeyboard import ReplyKeyboard
|
||||
from pyrogram.types import KeyboardButton
|
||||
from pykeyboard import ReplyKeyboard, ReplyButton
|
||||
|
||||
|
||||
keyboard = ReplyKeyboard(row_width=3)
|
||||
keyboard.add(
|
||||
KeyboardButton('1', 'reply_keyboard#1'),
|
||||
KeyboardButton('2', 'reply_keyboard#2'),
|
||||
KeyboardButton('3', 'reply_keyboard#3'),
|
||||
KeyboardButton('4', 'reply_keyboard#4'),
|
||||
KeyboardButton('5', 'reply_keyboard#5'),
|
||||
ReplyButton('Reply button 1'),
|
||||
ReplyButton('Reply button 2'),
|
||||
ReplyButton('Reply button 3'),
|
||||
ReplyButton('Reply button 4'),
|
||||
ReplyButton('Reply button 5')
|
||||
)
|
||||
```
|
||||
|
||||
@ -233,18 +230,17 @@ keyboard.add(
|
||||
#### Code
|
||||
|
||||
```python
|
||||
from pykeyboard import ReplyKeyboard
|
||||
from pyrogram.types import KeyboardButton
|
||||
from pykeyboard import ReplyKeyboard, ReplyButton
|
||||
|
||||
|
||||
keyboard = ReplyKeyboard()
|
||||
keyboard.row(KeyboardButton('1', 'reply_keyboard#1'))
|
||||
keyboard.row(ReplyButton('Reply button 1'))
|
||||
keyboard.row(
|
||||
KeyboardButton('2', 'reply_keyboard#2'),
|
||||
KeyboardButton('3', 'reply_keyboard#3')
|
||||
ReplyButton('Reply button 2'),
|
||||
ReplyButton('Reply button 3')
|
||||
)
|
||||
keyboard.row(KeyboardButton('4', 'reply_keyboard#4'))
|
||||
keyboard.row(KeyboardButton('5', 'reply_keyboard#5'))
|
||||
keyboard.row(ReplyButton('Reply button 4'))
|
||||
keyboard.row(ReplyButton('Reply button 5'))
|
||||
```
|
||||
|
||||
#### Result
|
||||
|
@ -1,11 +1,10 @@
|
||||
__title__ = 'pykeyboard'
|
||||
__version__ = '0.1.2'
|
||||
__version__ = '0.1.3'
|
||||
__author__ = 'PyMaster'
|
||||
__license__ = 'MIT License'
|
||||
__copyright__ = 'Copyright 2020 PyMaster'
|
||||
|
||||
from .inline_keyboard import InlineKeyboard
|
||||
from .inline_pagination_keyboard import InlinePaginationKeyboard
|
||||
from .reply_keyboard import ReplyKeyboard
|
||||
from .inline_query_results import InlineQueryResults
|
||||
__copyright__ = 'Copyright 2020-2022 PyMaster'
|
||||
|
||||
from .inline_keyboard import InlineKeyboard, InlineButton
|
||||
from .inline_pagination_keyboard import InlinePaginationKeyboard, InlineButton
|
||||
from .reply_keyboard import (
|
||||
ReplyKeyboard, ReplyButton, ReplyKeyboardRemove, ForceReply)
|
||||
|
@ -105,3 +105,19 @@ class InlineKeyboard(InlineKeyboardMarkup):
|
||||
self.callback_pattern = callback_pattern
|
||||
|
||||
return self.inline_keyboard.append(self._build_pagination)
|
||||
|
||||
|
||||
class InlineButton(InlineKeyboardButton):
|
||||
def __init__(self, text=None, callback_data=None, url=None,
|
||||
login_url=None, user_id=None, switch_inline_query=None,
|
||||
switch_inline_query_current_chat=None, callback_game=None):
|
||||
super().__init__(
|
||||
text=text,
|
||||
callback_data=callback_data,
|
||||
url=url,
|
||||
login_url=login_url,
|
||||
user_id=user_id,
|
||||
switch_inline_query=switch_inline_query,
|
||||
switch_inline_query_current_chat=switch_inline_query_current_chat,
|
||||
callback_game=callback_game
|
||||
)
|
||||
|
@ -99,3 +99,19 @@ class InlinePaginationKeyboard(InlineKeyboardMarkup):
|
||||
@property
|
||||
def markup(self):
|
||||
self.inline_keyboard.append(self.build_pagination)
|
||||
|
||||
|
||||
class InlineButton(InlineKeyboardButton):
|
||||
def __init__(self, text=None, callback_data=None, url=None,
|
||||
login_url=None, user_id=None, switch_inline_query=None,
|
||||
switch_inline_query_current_chat=None, callback_game=None):
|
||||
super().__init__(
|
||||
text=text,
|
||||
callback_data=callback_data,
|
||||
url=url,
|
||||
login_url=login_url,
|
||||
user_id=user_id,
|
||||
switch_inline_query=switch_inline_query,
|
||||
switch_inline_query_current_chat=switch_inline_query_current_chat,
|
||||
callback_game=callback_game
|
||||
)
|
||||
|
@ -1,4 +1,5 @@
|
||||
from pyrogram.types import ReplyKeyboardMarkup
|
||||
from pyrogram.types import (
|
||||
ReplyKeyboardMarkup, KeyboardButton, ReplyKeyboardRemove, ForceReply)
|
||||
|
||||
|
||||
class ReplyKeyboard(ReplyKeyboardMarkup):
|
||||
@ -21,3 +22,22 @@ class ReplyKeyboard(ReplyKeyboardMarkup):
|
||||
|
||||
def row(self, *args):
|
||||
self.keyboard.append([button for button in args])
|
||||
|
||||
|
||||
class ReplyButton(KeyboardButton):
|
||||
def __init__(self, text=None, request_contact=None, request_location=None):
|
||||
super().__init__(
|
||||
text=text,
|
||||
request_contact=request_contact,
|
||||
request_location=request_location
|
||||
)
|
||||
|
||||
|
||||
class ReplyKeyboardRemove(ReplyKeyboardRemove):
|
||||
def __init__(self, selective=None):
|
||||
super().__init__(selective=selective)
|
||||
|
||||
|
||||
class ForceReply(ForceReply):
|
||||
def __init__(self, selective=None):
|
||||
super().__init__(selective=selective)
|
||||
|
3
setup.py
3
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.2',
|
||||
version='0.1.3',
|
||||
author='PyMaster',
|
||||
author_email='',
|
||||
description='Best Keyboard and Pagination for the Pyrogram Library.',
|
||||
@ -20,6 +20,7 @@ setup(
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
'Programming Language :: Python :: 3.9',
|
||||
'Topic :: Internet',
|
||||
'Topic :: Communications',
|
||||
'Topic :: Communications :: Chat',
|
||||
|
Reference in New Issue
Block a user