mirror of
https://github.com/djimboy/djimbo_template_aio3.git
synced 2026-07-25 01:34:30 +00:00
Update
This commit is contained in:
@@ -7,7 +7,8 @@ from typing import Union
|
||||
|
||||
import pytz
|
||||
from aiogram import Bot
|
||||
from aiogram.types import InlineKeyboardButton, KeyboardButton, WebAppInfo, Message
|
||||
from aiogram.types import InlineKeyboardButton, KeyboardButton, WebAppInfo, Message, InlineKeyboardMarkup, \
|
||||
ReplyKeyboardMarkup
|
||||
|
||||
from tgbot.data.config import get_admins, BOT_TIMEZONE
|
||||
|
||||
@@ -38,6 +39,29 @@ async def del_message(message: Message):
|
||||
...
|
||||
|
||||
|
||||
# Умная отправка сообщений (автоотправка сообщения с фото или без)
|
||||
async def smart_message(
|
||||
bot: Bot,
|
||||
user_id: int,
|
||||
text: str,
|
||||
keyboard: Union[InlineKeyboardMarkup, ReplyKeyboardMarkup] = None,
|
||||
photo: Union[str, None] = None,
|
||||
):
|
||||
if photo is not None and photo.title() != "None":
|
||||
await bot.send_photo(
|
||||
chat_id=user_id,
|
||||
photo=photo,
|
||||
caption=text,
|
||||
reply_markup=keyboard,
|
||||
)
|
||||
else:
|
||||
await bot.send_message(
|
||||
chat_id=user_id,
|
||||
text=text,
|
||||
reply_markup=keyboard,
|
||||
)
|
||||
|
||||
|
||||
# Отправка сообщения всем админам
|
||||
async def send_admins(bot: Bot, text: str, markup=None, not_me=0):
|
||||
for admin in get_admins():
|
||||
|
||||
Reference in New Issue
Block a user