Template
mirror of
https://github.com/djimboy/djimbo_template_aio3.git
synced 2026-08-26 23:17:43 +00:00
Update
This commit is contained in:
@@ -12,12 +12,12 @@ from tgbot.data.config import get_admins
|
|||||||
|
|
||||||
######################################## AIOGRAM ########################################
|
######################################## AIOGRAM ########################################
|
||||||
# Генерация реплай кнопки
|
# Генерация реплай кнопки
|
||||||
def rkb(text) -> KeyboardButton:
|
def rkb(text: str) -> KeyboardButton:
|
||||||
return KeyboardButton(text=text)
|
return KeyboardButton(text=text)
|
||||||
|
|
||||||
|
|
||||||
# Генерация инлайн кнопки
|
# Генерация инлайн кнопки
|
||||||
def ikb(text, data=None, url=None, switch=None) -> InlineKeyboardButton:
|
def ikb(text: str, data: str = None, url: str = None, switch: str = None) -> InlineKeyboardButton:
|
||||||
if data is not None:
|
if data is not None:
|
||||||
return InlineKeyboardButton(text=text, callback_data=data)
|
return InlineKeyboardButton(text=text, callback_data=data)
|
||||||
elif url is not None:
|
elif url is not None:
|
||||||
@@ -27,11 +27,11 @@ def ikb(text, data=None, url=None, switch=None) -> InlineKeyboardButton:
|
|||||||
|
|
||||||
|
|
||||||
# Отправка сообщения всем админам
|
# Отправка сообщения всем админам
|
||||||
async def send_admins(bot: Bot, message, markup=None, not_me=0):
|
async def send_admins(bot: Bot, text: str, markup=None, not_me=0):
|
||||||
for admin in get_admins():
|
for admin in get_admins():
|
||||||
try:
|
try:
|
||||||
if str(admin) != str(not_me):
|
if str(admin) != str(not_me):
|
||||||
await bot.send_message(admin, message, reply_markup=markup, disable_web_page_preview=True)
|
await bot.send_message(admin, text, reply_markup=markup, disable_web_page_preview=True)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -114,16 +114,13 @@ def clear_list(get_list: list) -> list:
|
|||||||
|
|
||||||
|
|
||||||
# Разбив списка на несколько частей
|
# Разбив списка на несколько частей
|
||||||
def split_messages(get_list: list, count: int):
|
def split_messages(get_list: list, count: int) -> list[list]:
|
||||||
return [get_list[i:i + count] for i in range(0, len(get_list), count)]
|
return [get_list[i:i + count] for i in range(0, len(get_list), count)]
|
||||||
|
|
||||||
|
|
||||||
# Получение даты
|
# Получение даты
|
||||||
def get_date() -> str:
|
def get_date() -> str:
|
||||||
this_date = datetime.today().replace(microsecond=0)
|
return datetime.today().replace(microsecond=0).strftime("%d.%m.%Y %H:%M:%S")
|
||||||
this_date = this_date.strftime("%d.%m.%Y %H:%M:%S")
|
|
||||||
|
|
||||||
return this_date
|
|
||||||
|
|
||||||
|
|
||||||
# Получение юникс даты
|
# Получение юникс даты
|
||||||
|
|||||||
Reference in New Issue
Block a user