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:
@@ -0,0 +1,3 @@
|
||||
from aiogram.utils.callback_data import CallbackData
|
||||
|
||||
some_callback = CallbackData("new")
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
from typing import List, Tuple, Dict
|
||||
|
||||
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
||||
from aiogram.utils.callback_data import CallbackData
|
||||
|
||||
from . import utils
|
||||
|
||||
|
||||
class InlineConstructor:
|
||||
@staticmethod
|
||||
def _create_kb(actions: List[Tuple[str, Dict[str, str], CallbackData]], schema: List[int]) -> InlineKeyboardMarkup:
|
||||
btns = []
|
||||
for a, b, c in actions:
|
||||
btns.append(
|
||||
InlineKeyboardButton(
|
||||
text=a,
|
||||
callback_data=c.new(**b)
|
||||
)
|
||||
)
|
||||
kb = utils.misc.arrange_inline_schema(btns, schema)
|
||||
return kb
|
||||
@@ -1 +0,0 @@
|
||||
from . import misc
|
||||
@@ -1,17 +0,0 @@
|
||||
from typing import List
|
||||
|
||||
from aiogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
||||
|
||||
|
||||
def arrange_inline_schema(buttons: List[InlineKeyboardButton], count: List[int]) -> InlineKeyboardMarkup:
|
||||
kb = InlineKeyboardMarkup()
|
||||
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.inline_keyboard = tmplist
|
||||
return kb
|
||||
Reference in New Issue
Block a user