Delete examples directory
Removed deprecated examples
This commit is contained in:
parent
3c74499565
commit
e35e471387
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2020 PyMaster
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the 'Software'), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,19 +0,0 @@
|
|||
# Example: Telegram Pyrogram bot
|
||||
|
||||
## Bot launch
|
||||
|
||||
```shell
|
||||
cd examples
|
||||
python -m bot
|
||||
```
|
||||
|
||||
## Bot settings
|
||||
|
||||
```python
|
||||
SESSION_NAME = 'bot'
|
||||
API_ID = '' # https://my.telegram.org/
|
||||
API_HASH = '' # https://my.telegram.org/
|
||||
BOT_TOKEN = '' # @BotFather
|
||||
APP_PLUGINS = 'bot/modules'
|
||||
|
||||
```
|
|
@ -1,20 +0,0 @@
|
|||
from .config import (SESSION_NAME, API_ID, API_HASH,
|
||||
BOT_TOKEN, APP_PLUGINS)
|
||||
from pyrogram import Client
|
||||
|
||||
|
||||
class App(Client):
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
session_name=SESSION_NAME,
|
||||
api_id=API_ID,
|
||||
api_hash=API_HASH,
|
||||
bot_token=BOT_TOKEN,
|
||||
plugins=dict(root=APP_PLUGINS)
|
||||
)
|
||||
|
||||
def start(self, *args):
|
||||
super().start()
|
||||
|
||||
def stop(self, *args):
|
||||
super().stop()
|
|
@ -1,5 +0,0 @@
|
|||
from . import App
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
App().run()
|
|
@ -1,5 +0,0 @@
|
|||
SESSION_NAME = 'bot'
|
||||
API_ID = '' # https://my.telegram.org/
|
||||
API_HASH = '' # https://my.telegram.org/
|
||||
BOT_TOKEN = '' # @BotFather
|
||||
APP_PLUGINS = 'bot/modules'
|
|
@ -1,70 +0,0 @@
|
|||
from .. import App
|
||||
from pykeyboard import InlineKeyboard
|
||||
from pyrogram import Filters, InlineKeyboardButton
|
||||
|
||||
|
||||
@App.on_message(Filters.command('inline_keyboard'))
|
||||
def inline_keyboard_command(client, message):
|
||||
message.reply_text(
|
||||
'<b>Inline keyboard:</b>\n\n'
|
||||
'/add_inline_button - add buttons\n'
|
||||
'/row_inline_button - add button row\n'
|
||||
)
|
||||
|
||||
|
||||
@App.on_message(Filters.command('add_inline_button'))
|
||||
def add_inline_button_command(client, message):
|
||||
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')
|
||||
)
|
||||
message.reply_text(
|
||||
'<b>Add buttons:</b>\n\n'
|
||||
'<code>keyboard = InlineKeyboard(row_width=3)</code>\n'
|
||||
'<code>keyboard.add(</code>\n'
|
||||
"<code> InlineKeyboardButton('1', 'inline_keyboard#1'),</code>\n"
|
||||
"<code> InlineKeyboardButton('2', 'inline_keyboard#2'),</code>\n"
|
||||
"<code> InlineKeyboardButton('3', 'inline_keyboard#3'),</code>\n"
|
||||
"<code> InlineKeyboardButton('4', 'inline_keyboard#4'),</code>\n"
|
||||
"<code> InlineKeyboardButton('5', 'inline_keyboard#5'),</code>\n"
|
||||
"<code> InlineKeyboardButton('6', 'inline_keyboard#6'),</code>\n"
|
||||
"<code> InlineKeyboardButton('7', 'inline_keyboard#7')</code>\n"
|
||||
'<code>)</code>\n',
|
||||
reply_markup=keyboard
|
||||
)
|
||||
|
||||
|
||||
@App.on_message(Filters.command('row_inline_button'))
|
||||
def row_inline_button_command(client, message):
|
||||
keyboard = InlineKeyboard()
|
||||
keyboard.row(InlineKeyboardButton('1', 'inline_keyboard#1'))
|
||||
keyboard.row(
|
||||
InlineKeyboardButton('2', 'inline_keyboard#2'),
|
||||
InlineKeyboardButton('3', 'inline_keyboard#3')
|
||||
)
|
||||
keyboard.row(InlineKeyboardButton('4', 'inline_keyboard#4'))
|
||||
keyboard.row(
|
||||
InlineKeyboardButton('5', 'inline_keyboard#5'),
|
||||
InlineKeyboardButton('6', 'inline_keyboard#6')
|
||||
)
|
||||
message.reply_text(
|
||||
'<b>Add button row:</b>\n\n'
|
||||
"<code>keyboard = InlineKeyboard()</code>\n"
|
||||
"<code>keyboard.row(InlineKeyboardButton('1', 'inline_keyboard#1'))</code>\n"
|
||||
"<code>keyboard.row(</code>\n"
|
||||
"<code> InlineKeyboardButton('2', 'inline_keyboard#2'),</code>\n"
|
||||
"<code> InlineKeyboardButton('3', 'inline_keyboard#3')</code>\n"
|
||||
"<code>)</code>\n"
|
||||
"<code>keyboard.row(InlineKeyboardButton('4', 'inline_keyboard#4'))</code>\n"
|
||||
"<code>keyboard.row(</code>\n"
|
||||
"<code> InlineKeyboardButton('5', 'inline_keyboard#5'),</code>\n"
|
||||
"<code> InlineKeyboardButton('6', 'inline_keyboard#6')</code>\n"
|
||||
"<code>)</code>\n",
|
||||
reply_markup=keyboard
|
||||
)
|
|
@ -1,10 +0,0 @@
|
|||
from .. import App
|
||||
from pyrogram import Filters
|
||||
|
||||
|
||||
@App.on_message(Filters.command('install'))
|
||||
def install_command(client, message):
|
||||
message.reply_text(
|
||||
'<b>Installation:</b>\n\n'
|
||||
'<code>pip install -U pykeyboard</code>'
|
||||
)
|
|
@ -1,86 +0,0 @@
|
|||
from .. import App
|
||||
from pyrogram import Filters, InlineKeyboardButton
|
||||
from pykeyboard import InlinePaginationKeyboard
|
||||
|
||||
|
||||
TEXT = 'sed risus pretium quam vulputate dignissim suspendisse in est ante in nibh mauris cursus mattis molestie a iaculis at erat pellentesque adipiscing commodo elit at imperdiet dui accumsan sit amet nulla facilisi morbi tempus iaculis urna id volutpat lacus laoreet non curabitur gravida arcu ac tortor dignissim convallis aenean et'
|
||||
|
||||
|
||||
@App.on_message(Filters.command('pagination_keyboard'))
|
||||
def pagination_keyboard_command(client, message):
|
||||
message.reply_text(
|
||||
'<b>Pagination inline keyboard:</b>\n\n'
|
||||
'/pagination_keyboard_3 - 3 pages\n'
|
||||
'/pagination_keyboard_5 - 5 pages\n'
|
||||
'/pagination_keyboard_9 - 9 pages\n'
|
||||
'/pagination_keyboard_25 - 25 pages\n'
|
||||
'/pagination_keyboard_100 - 100 pages\n'
|
||||
'/pagination_keyboard_150 - 150 page and buttons'
|
||||
)
|
||||
|
||||
|
||||
@App.on_message(Filters.command('pagination_keyboard_3'))
|
||||
def pagination_keyboard_3_command(client, message):
|
||||
keyboard = InlinePaginationKeyboard(3, 3, 'pagination_keyboard#{number}')
|
||||
|
||||
message.reply_text(
|
||||
f'<b>3 page pagination:</b>\n\n {TEXT}',
|
||||
reply_markup=keyboard
|
||||
)
|
||||
|
||||
|
||||
@App.on_message(Filters.command('pagination_keyboard_5'))
|
||||
def pagination_keyboard_5_command(client, message):
|
||||
keyboard = InlinePaginationKeyboard(5, 3, 'pagination_keyboard#{number}')
|
||||
|
||||
message.reply_text(
|
||||
f'<b>5 page pagination:</b>\n\n {TEXT}',
|
||||
reply_markup=keyboard
|
||||
)
|
||||
|
||||
|
||||
@App.on_message(Filters.command('pagination_keyboard_9'))
|
||||
def pagination_keyboard_9_command(client, message):
|
||||
keyboard = InlinePaginationKeyboard(9, 5, 'pagination_keyboard#{number}')
|
||||
|
||||
message.reply_text(
|
||||
f'<b>9 page pagination:</b>\n\n {TEXT}',
|
||||
reply_markup=keyboard
|
||||
)
|
||||
|
||||
|
||||
@App.on_message(Filters.command('pagination_keyboard_25'))
|
||||
def pagination_keyboard_25_command(client, message):
|
||||
keyboard = InlinePaginationKeyboard(
|
||||
25, 14, 'pagination_keyboard#{number}')
|
||||
|
||||
message.reply_text(
|
||||
f'<b>25 page pagination:</b>\n\n {TEXT}',
|
||||
reply_markup=keyboard
|
||||
)
|
||||
|
||||
|
||||
@App.on_message(Filters.command('pagination_keyboard_100'))
|
||||
def pagination_keyboard_100_command(client, message):
|
||||
keyboard = InlinePaginationKeyboard(
|
||||
100, 100, 'pagination_keyboard#{number}')
|
||||
|
||||
message.reply_text(
|
||||
f'<b>100 page pagination:</b>\n\n {TEXT}',
|
||||
reply_markup=keyboard
|
||||
)
|
||||
|
||||
|
||||
@App.on_message(Filters.command('pagination_keyboard_150'))
|
||||
def pagination_keyboard_150_command(client, message):
|
||||
keyboard = InlinePaginationKeyboard(
|
||||
150, 123, 'pagination_keyboard#{number}')
|
||||
keyboard.row(
|
||||
InlineKeyboardButton('Back', 'pagination_keyboard#back'),
|
||||
InlineKeyboardButton('Close', 'pagination_keyboard#close')
|
||||
)
|
||||
|
||||
message.reply_text(
|
||||
f'<b>150 page pagination and buttons:</b>\n\n {TEXT}',
|
||||
reply_markup=keyboard
|
||||
)
|
|
@ -1,60 +0,0 @@
|
|||
from .. import App
|
||||
from pykeyboard import ReplyKeyboard
|
||||
from pyrogram import Filters, KeyboardButton
|
||||
|
||||
|
||||
@App.on_message(Filters.command('reply_keyboard'))
|
||||
def reply_keyboard_command(client, message):
|
||||
message.reply_text(
|
||||
'<b>Reply keyboard:</b>\n\n'
|
||||
'/add_reply_button - add buttons\n'
|
||||
'/row_reply_button - add button row\n'
|
||||
)
|
||||
|
||||
|
||||
@App.on_message(Filters.command('add_reply_button'))
|
||||
def add_reply_button_command(client, message):
|
||||
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'),
|
||||
)
|
||||
message.reply_text(
|
||||
'<b>Add buttons:</b>\n\n'
|
||||
'<code>keyboard = ReplyKeyboard(row_width=3)</code>\n'
|
||||
'<code>keyboard.add(</code>\n'
|
||||
"<code> KeyboardButton('1', 'reply_keyboard#1'),</code>\n"
|
||||
"<code> KeyboardButton('2', 'reply_keyboard#2'),</code>\n"
|
||||
"<code> KeyboardButton('3', 'reply_keyboard#3'),</code>\n"
|
||||
"<code> KeyboardButton('4', 'reply_keyboard#4'),</code>\n"
|
||||
"<code> KeyboardButton('5', 'reply_keyboard#5'),</code>\n"
|
||||
'<code>)</code>\n',
|
||||
reply_markup=keyboard
|
||||
)
|
||||
|
||||
|
||||
@App.on_message(Filters.command('row_reply_button'))
|
||||
def row_reply_button_command(client, message):
|
||||
keyboard = ReplyKeyboard()
|
||||
keyboard.row(KeyboardButton('1', 'reply_keyboard#1'))
|
||||
keyboard.row(
|
||||
KeyboardButton('2', 'reply_keyboard#2'),
|
||||
KeyboardButton('3', 'reply_keyboard#3')
|
||||
)
|
||||
keyboard.row(KeyboardButton('4', 'reply_keyboard#4'))
|
||||
keyboard.row(KeyboardButton('5', 'reply_keyboard#5'))
|
||||
message.reply_text(
|
||||
'<b>Add button row:</b>\n\n'
|
||||
"<code>keyboard = ReplyKeyboard()</code>\n"
|
||||
"<code>keyboard.row(KeyboardButton('1', 'reply_keyboard#1'))</code>\n"
|
||||
"<code>keyboard.row(</code>\n"
|
||||
"<code> KeyboardButton('2', 'reply_keyboard#2'),</code>\n"
|
||||
"<code> KeyboardButton('3', 'reply_keyboard#3')</code>\n"
|
||||
"<code>)</code>\n"
|
||||
"<code>keyboard.row(KeyboardButton('4', 'reply_keyboard#4'))</code>\n"
|
||||
"<code>keyboard.row(KeyboardButton('5', 'reply_keyboard#5'))</code>\n",
|
||||
reply_markup=keyboard
|
||||
)
|
|
@ -1,15 +0,0 @@
|
|||
from .. import App
|
||||
from pyrogram import Filters
|
||||
|
||||
|
||||
@App.on_message(Filters.command(['start', 'help']))
|
||||
def start_command(client, message):
|
||||
message.reply_text(
|
||||
f'Welcome <b>{message.from_user.first_name}</b>!\n\n'
|
||||
'I will help you learn how to wrk with the <b>pykeyboard</b> library.\n\n'
|
||||
'<b>Library features:</b>\n\n'
|
||||
'/install - library installation\n'
|
||||
'/inline_keyboard - inline keyboard\n'
|
||||
'/pagination_keyboard - pagination inline keyboard\n'
|
||||
'/reply_keyboard - reply keyboard'
|
||||
)
|
Loading…
Reference in New Issue
Block a user