actual commit for admin-menu

This commit is contained in:
Vladless
2025-05-28 22:14:07 +03:00
parent b442e70657
commit e67dce82d6
2 changed files with 45 additions and 6 deletions
+37 -4
View File
@@ -20,14 +20,47 @@ dp = Dispatcher(bot=bot, storage=storage)
def get_git_commit_number() -> str:
repo_url = "https://github.com/Vladless/Solo_bot"
try:
count = subprocess.check_output(["git", "rev-list", "--count", "HEAD"])
return count.decode("utf-8").strip()
local_number = subprocess.check_output(
["git", "rev-list", "--count", "HEAD"]
).decode().strip()
local_hash = subprocess.check_output(
["git", "rev-parse", "HEAD"]
).decode().strip()
except Exception:
return "unknown"
return "\n(Требуется обновление через CLI)"
try:
remote_commit = subprocess.check_output(
["git", "ls-remote", "origin", "refs/heads/dev"]
).decode()
remote_hash = remote_commit.split()[0]
remote_number = subprocess.check_output(
["git", "rev-list", "--count", remote_hash]
).decode().strip()
if local_hash == remote_hash:
return "\n(Актуальная версия)"
return (
f"\n(commit <a href=\"{repo_url}/commit/{local_hash}\">"
f"#{local_number}</a> / actual commit "
f"<a href=\"{repo_url}/commit/{remote_hash}\">#{remote_number}</a>)"
)
except Exception:
return (
f"\n(commit <a href=\"{repo_url}/commit/{local_hash}\">"
f"#{local_number}</a> / actual commit unknown)"
)
version = f"4.3-b240504 (commit #{get_git_commit_number()})"
version = f"v4.3-b240504{get_git_commit_number()}"
dp.message.filter(IsPrivateFilter())
dp.callback_query.filter(IsPrivateFilter())
+8 -2
View File
@@ -22,7 +22,9 @@ async def handle_admin_callback_query(callback_query: CallbackQuery, state: FSMC
if callback_query.message.text:
try:
await callback_query.message.edit_text(
text=text, reply_markup=build_panel_kb()
text=text,
reply_markup=build_panel_kb(),
disable_web_page_preview=True,
)
except TelegramBadRequest as e:
if "message is not modified" in str(e):
@@ -37,7 +39,11 @@ async def handle_admin_callback_query(callback_query: CallbackQuery, state: FSMC
except Exception as e:
logger.error(f"Ошибка при удалении сообщения: {e}")
await callback_query.message.answer(text=text, reply_markup=build_panel_kb())
await callback_query.message.answer(
text=text,
reply_markup=build_panel_kb(),
disable_web_page_preview=True,
)
@router.callback_query(F.data == "admin", IsAdminFilter())