Update aiogram 3 template

This commit is contained in:
dj
2026-05-29 09:44:39 +03:00
parent e144cb1424
commit 2eced5dc4f
43 changed files with 1877 additions and 1252 deletions
+11 -7
View File
@@ -2,24 +2,28 @@
from aiogram import Bot
from aiogram.types import FSInputFile
from tgbot.data.config import get_admins, PATH_DATABASE, BOT_STATUS_NOTIFICATION
from tgbot.data.config import BOT_DATABASE_EXPORT, BOT_STATUS_NOTIFICATION, PATH_DATABASE, get_admins
from tgbot.utils.const_functions import get_date, send_admins
from tgbot.utils.misc.bot_logging import bot_logger
# Notification after run bot (for all admins)
# Уведомление админам после запуска
async def startup_notify(bot: Bot):
if len(get_admins()) >= 1 and BOT_STATUS_NOTIFICATION:
await send_admins(bot, "<b>✅ Bot was started</b>")
await send_admins(bot, "<b>✅ Бот запущен</b>")
# Autobackup Database
# Автобэкап базы для админов
async def autobackup_admin(bot: Bot):
if not BOT_DATABASE_EXPORT:
return
for admin in get_admins():
try:
await bot.send_document(
admin,
FSInputFile(PATH_DATABASE),
caption=f"<b>📦 #AUTOBACKUP | <code>{get_date()}</code></b>",
caption=f"<b>📦 #АВТОБЭКАП | <code>{get_date()}</code></b>",
)
except:
...
except Exception:
bot_logger.warning("Не удалось отправить автобэкап админу %s", admin, exc_info=True)