refactor: remove Alembic migrations and Discord integration

This commit is contained in:
2026-07-15 15:55:25 +05:00
parent e8cff0f7ed
commit ec5ae395f3
24 changed files with 559 additions and 1718 deletions
+30 -15
View File
@@ -7,8 +7,13 @@ from typing import Union
from aiogram import Bot
from aiogram.types import FSInputFile, CallbackQuery, Message
from tgbot.data.config import BOT_DATABASE_EXPORT, BOT_STATUS_NOTIFICATION, BOT_VERSION, PATH_DATABASE, get_admins, \
get_text_desc
from tgbot.data.config import (
BOT_DATABASE_EXPORT,
BOT_STATUS_NOTIFICATION,
BOT_VERSION,
PATH_DATABASE,
get_admins,
)
from tgbot.database import Userx, Settingsx
from tgbot.utils.const_functions import get_unix, get_date, ded, send_admins
from tgbot.utils.misc.bot_logging import bot_logger
@@ -40,9 +45,17 @@ async def autosettings_unix():
now_month = datetime.now().month
now_year = datetime.now().year
unix_day = int(datetime.strptime(f"{now_day}.{now_month}.{now_year} 0:0:0", "%d.%m.%Y %H:%M:%S").timestamp())
unix_day = int(
datetime.strptime(
f"{now_day}.{now_month}.{now_year} 0:0:0", "%d.%m.%Y %H:%M:%S"
).timestamp()
)
unix_week = unix_day - (now_week * 86400)
unix_month = int(datetime.strptime(f"1.{now_month}.{now_year} 0:0:0", "%d.%m.%Y %H:%M:%S").timestamp())
unix_month = int(
datetime.strptime(
f"1.{now_month}.{now_year} 0:0:0", "%d.%m.%Y %H:%M:%S"
).timestamp()
)
await Settingsx().update(
misc_profit_day=unix_day,
@@ -68,8 +81,6 @@ async def startup_notify(bot: Bot, arSession: ARS):
ded(f"""
<b>✅ Бот был успешно запущен</b>
➖➖➖➖➖➖➖➖➖➖
{get_text_desc()}
➖➖➖➖➖➖➖➖➖➖
<code>❗ Данное сообщение видят только администраторы бота.</code>
"""),
)
@@ -91,7 +102,9 @@ async def autobackup_admin(bot: Bot):
disable_notification=True,
)
except Exception:
bot_logger.warning("Не удалось отправить автобэкап админу %s", admin, exc_info=True)
bot_logger.warning(
"Не удалось отправить автобэкап админу %s", admin, exc_info=True
)
# Проверка наличия обновлений бота
@@ -106,7 +119,7 @@ async def check_update(bot: Bot, arSession: ARS):
response_data = json.loads((await response.read()).decode())
if float(response_data['version']) > float(BOT_VERSION):
if float(response_data["version"]) > float(BOT_VERSION):
await send_admins(
bot,
ded(f"""
@@ -132,7 +145,7 @@ async def check_mail(bot: Bot, arSession: ARS):
)
response_data = json.loads((await response.read()).decode())
if response_data['status']:
if response_data["status"]:
await send_admins(
bot,
ded(f"""
@@ -176,21 +189,23 @@ async def functions_mail_make(bot: Bot, message: Message, call: CallbackQuery):
users_receive += 1
except Exception:
users_block += 1
bot_logger.debug("Пользователь %s не получил рассылку", user.user_id, exc_info=True)
bot_logger.debug(
"Пользователь %s не получил рассылку", user.user_id, exc_info=True
)
users_count += 1
if users_count % 10 == 0:
await call.message.edit_text(f"<b>📢 Рассылка началась... ({users_count}/{len(get_users)})</b>")
await call.message.edit_text(
f"<b>📢 Рассылка началась... ({users_count}/{len(get_users)})</b>"
)
await asyncio.sleep(0.07)
await call.message.edit_text(
ded(f"""
await call.message.edit_text(ded(f"""
<b>📢 Рассылка была завершена за <code>{get_unix() - get_time}сек</code></b>
➖➖➖➖➖➖➖➖➖➖
👤 Всего пользователей: <code>{len(get_users)}</code>
✅ Пользователей получило сообщение: <code>{users_receive}</code>
❌ Пользователей не получило сообщение: <code>{users_block}</code>
""")
)
"""))