This commit is contained in:
Djimbo
2023-01-19 05:31:54 +03:00
parent edf796a76d
commit 2c64b6208d
13 changed files with 67 additions and 58 deletions
+3 -2
View File
@@ -4,10 +4,11 @@ import time
from datetime import datetime
from typing import Union
import pytz
from aiogram import Bot, types
from aiogram.types import InlineKeyboardButton, KeyboardButton
from tgbot.data.config import get_admins
from tgbot.data.config import get_admins, BOT_TIMEZONE
######################################## AIOGRAM ########################################
@@ -120,7 +121,7 @@ def split_messages(get_list: list, count: int) -> list[list]:
# Получение даты
def get_date() -> str:
return datetime.today().replace(microsecond=0).strftime("%d.%m.%Y %H:%M:%S")
return datetime.now(pytz.timezone(BOT_TIMEZONE)).strftime("%d.%m.%Y %H:%M:%S")
# Получение юникс даты
+2 -2
View File
@@ -1,7 +1,7 @@
# - *- coding: utf- 8 - *-
from aiogram.fsm.context import FSMContext
from tgbot.services.api_session import AsyncSession
from tgbot.services.api_session import RequestSession
FSM = FSMContext
AS = AsyncSession
AS = RequestSession
+6 -4
View File
@@ -16,9 +16,11 @@ async def startup_notify(bot: Bot):
async def autobackup_admin(bot: Bot):
for admin in get_admins():
try:
await bot.send_document(admin,
FSInputFile(PATH_DATABASE),
caption=f"<b>📦 AUTOBACKUP</b>\n"
f"🕰 <code>{get_date()}</code>")
await bot.send_document(
admin,
FSInputFile(PATH_DATABASE),
caption=f"<b>📦 AUTOBACKUP</b>\n"
f"🕰 <code>{get_date()}</code>",
)
except:
pass