Refactor bot and integrate services
This commit is contained in:
68
keyboards.py
Normal file
68
keyboards.py
Normal file
@@ -0,0 +1,68 @@
|
||||
from aiogram.types import (
|
||||
ReplyKeyboardMarkup,
|
||||
KeyboardButton,
|
||||
InlineKeyboardMarkup,
|
||||
InlineKeyboardButton,
|
||||
)
|
||||
from state import DOCKER_MAP
|
||||
|
||||
menu_kb = ReplyKeyboardMarkup(
|
||||
keyboard=[
|
||||
[KeyboardButton(text="🩺 Health"), KeyboardButton(text="📊 Статус")],
|
||||
[KeyboardButton(text="🐳 Docker"), KeyboardButton(text="📦 Backup")],
|
||||
[KeyboardButton(text="🧉 Artifacts"), KeyboardButton(text="⚙️ System")],
|
||||
[KeyboardButton(text="ℹ️ Help")],
|
||||
],
|
||||
resize_keyboard=True,
|
||||
)
|
||||
|
||||
docker_kb = ReplyKeyboardMarkup(
|
||||
keyboard=[
|
||||
[KeyboardButton(text="🐳 Status")],
|
||||
[KeyboardButton(text="🔄 Restart"), KeyboardButton(text="📜 Logs")],
|
||||
[KeyboardButton(text="⬅️ Назад")],
|
||||
],
|
||||
resize_keyboard=True,
|
||||
)
|
||||
|
||||
backup_kb = ReplyKeyboardMarkup(
|
||||
keyboard=[
|
||||
[KeyboardButton(text="📦 Status")],
|
||||
[KeyboardButton(text="📦 Last backup")],
|
||||
[KeyboardButton(text="📊 Repo stats")],
|
||||
[KeyboardButton(text="▶️ Run backup")],
|
||||
[KeyboardButton(text="🧯 Restore help")],
|
||||
[KeyboardButton(text="⬅️ Назад")],
|
||||
],
|
||||
resize_keyboard=True,
|
||||
)
|
||||
|
||||
artifacts_kb = ReplyKeyboardMarkup(
|
||||
keyboard=[
|
||||
[KeyboardButton(text="🧉 Status"), KeyboardButton(text="🧉 Last artifact")],
|
||||
[KeyboardButton(text="📤 Upload")],
|
||||
[KeyboardButton(text="⬅️ Назад")],
|
||||
],
|
||||
resize_keyboard=True,
|
||||
)
|
||||
|
||||
system_kb = ReplyKeyboardMarkup(
|
||||
keyboard=[
|
||||
[KeyboardButton(text="💽 Disks"), KeyboardButton(text="🔐 Security")],
|
||||
[KeyboardButton(text="🔄 Reboot")],
|
||||
[KeyboardButton(text="⬅️ Назад")],
|
||||
],
|
||||
resize_keyboard=True,
|
||||
)
|
||||
|
||||
|
||||
def docker_inline_kb(action: str) -> InlineKeyboardMarkup:
|
||||
rows = []
|
||||
for alias in DOCKER_MAP.keys():
|
||||
rows.append([
|
||||
InlineKeyboardButton(
|
||||
text=alias,
|
||||
callback_data=f"docker:{action}:{alias}"
|
||||
)
|
||||
])
|
||||
return InlineKeyboardMarkup(inline_keyboard=rows)
|
||||
Reference in New Issue
Block a user