Deleted mysql support, redis password, webhook, keyboard constructors, filters, loguru.
Added support of decorators in handlers Added function to notify admins on startup
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
from typing import List
|
||||
|
||||
from aiogram.types import ReplyKeyboardMarkup, KeyboardButton
|
||||
|
||||
from . import utils
|
||||
|
||||
|
||||
class DefaultConstructor:
|
||||
@staticmethod
|
||||
def _create_kb(actions: List[str], schema: List[int]) -> ReplyKeyboardMarkup:
|
||||
btns = []
|
||||
for a in actions:
|
||||
btns.append(KeyboardButton(a))
|
||||
kb = utils.misc.arrange_default_schema(btns, schema)
|
||||
return kb
|
||||
@@ -1 +0,0 @@
|
||||
from . import misc
|
||||
@@ -1,17 +0,0 @@
|
||||
from typing import List
|
||||
|
||||
from aiogram.types import ReplyKeyboardMarkup, KeyboardButton
|
||||
|
||||
|
||||
def arrange_default_schema(buttons: List[KeyboardButton], count: List[int]) -> ReplyKeyboardMarkup:
|
||||
kb = ReplyKeyboardMarkup(resize_keyboard=True)
|
||||
kb.row_width = max(count)
|
||||
if sum(count) != len(buttons):
|
||||
raise ValueError('Количество кнопок не совпадает со схемой')
|
||||
tmplist = []
|
||||
for a in count:
|
||||
tmplist.append([])
|
||||
for _ in range(a):
|
||||
tmplist[-1].append(buttons.pop(0))
|
||||
kb.keyboard = tmplist
|
||||
return kb
|
||||
Reference in New Issue
Block a user