Template
mirror of
https://github.com/djimboy/djimbo_template_aio3.git
synced 2026-08-26 15:07:43 +00:00
Update
This commit is contained in:
@@ -7,7 +7,8 @@ from typing import Union
|
|||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
from aiogram import Bot
|
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
|
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):
|
async def send_admins(bot: Bot, text: str, markup=None, not_me=0):
|
||||||
for admin in get_admins():
|
for admin in get_admins():
|
||||||
|
|||||||
Reference in New Issue
Block a user