diff options
Diffstat (limited to 'files/TG_bot_VPN-main/keyboards')
8 files changed, 143 insertions, 0 deletions
diff --git a/files/TG_bot_VPN-main/keyboards/__init__.py b/files/TG_bot_VPN-main/keyboards/__init__.py new file mode 100644 index 0000000..e1e9fef --- /dev/null +++ b/files/TG_bot_VPN-main/keyboards/__init__.py @@ -0,0 +1,2 @@ +from . import inline +from . import reply diff --git a/files/TG_bot_VPN-main/keyboards/inline/__init__.py b/files/TG_bot_VPN-main/keyboards/inline/__init__.py new file mode 100644 index 0000000..48c5cc6 --- /dev/null +++ b/files/TG_bot_VPN-main/keyboards/inline/__init__.py @@ -0,0 +1,3 @@ +from . import admin_buttons +from. import servers +from. import subscribed diff --git a/files/TG_bot_VPN-main/keyboards/inline/admin_buttons.py b/files/TG_bot_VPN-main/keyboards/inline/admin_buttons.py new file mode 100644 index 0000000..08fd456 --- /dev/null +++ b/files/TG_bot_VPN-main/keyboards/inline/admin_buttons.py @@ -0,0 +1,71 @@ +from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton + +from config_data.config import ALLOWED_USERS +from database.models import User, Server + + +def admin_markup(): + """ Inline buttons для выбора меню админа """ + actions = InlineKeyboardMarkup(row_width=2) + actions.add(InlineKeyboardButton(text=f"🖥 Управление серверами", callback_data="servers")) + actions.add(InlineKeyboardButton(text=f"👥 Управление пользователями", callback_data="users")) + actions.add(InlineKeyboardButton(text=f"🚪 Выйти", callback_data="Exit")) + return actions + + +def users_markup(): + """ Inline buttons для выбора юзера """ + users_obj = User.select() + actions = InlineKeyboardMarkup(row_width=2) + + for user in users_obj: + if int(user.user_id) not in ALLOWED_USERS: + actions.add(InlineKeyboardButton(text=f"👤 {user.full_name}", callback_data=user.id)) + actions.add(InlineKeyboardButton(text=f"🔙 Назад", callback_data="Exit")) + return actions + + +def get_servers_markup(): + """ Inline buttons для выдачи всех локаций серверов """ + actions = InlineKeyboardMarkup(row_width=1) + servers_obj = Server.select() + for server in servers_obj: + actions.add(InlineKeyboardButton(text=f"🌍 {server.location}", callback_data=str(server.id))) + actions.add(InlineKeyboardButton(text=f"➕ Добавить сервер", callback_data="Add")) + return actions + +def get_vpn_markup(server_id): + """ Inline buttons для выдачи vpn ключей сервера """ + cur_server: Server = Server.get_by_id(server_id) + actions = InlineKeyboardMarkup(row_width=2) + for vpn_key_obj in cur_server.keys: + actions.add(InlineKeyboardButton(text=f"🔑 {vpn_key_obj.name}", callback_data=f"VPN - {str(vpn_key_obj.id)}")) + actions.add(InlineKeyboardButton(text=f"🔄 Сгенерировать новый ключ", callback_data=f"Generate {cur_server.id}")) + actions.add(InlineKeyboardButton(text=f"🗑 Удалить сервер", callback_data=f"Delete {cur_server.id}"), + InlineKeyboardButton(text=f"🔙 Назад", callback_data="Cancel")) # Возврат в меню серверов + return actions + +def delete_vpn_markup(vpn_obj_id: int): + """ Inline buttons для удаления vpn ключа """ + actions = InlineKeyboardMarkup(row_width=2) + actions.add(InlineKeyboardButton(text=f"🗑 Удалить", callback_data=f"Del - {vpn_obj_id}"), + InlineKeyboardButton(text=f"🚪 Выйти", callback_data="Cancel")) + return actions + + +def key_actions_markup(key_id: int) -> InlineKeyboardMarkup: + """ + Клавиатура для управления ключом: + - Приостановить/возобновить + - Отозвать + - Назад + """ + markup = InlineKeyboardMarkup(row_width=2) + + markup.add( + InlineKeyboardButton("⏸ Приостановить", callback_data=f"action_suspend_{key_id}"), + InlineKeyboardButton("▶️ Возобновить", callback_data=f"action_resume_{key_id}"), + InlineKeyboardButton("🗑 Отозвать", callback_data=f"action_revoke_{key_id}"), + InlineKeyboardButton("🔙 Назад", callback_data="Cancel") + ) + return markup
\ No newline at end of file diff --git a/files/TG_bot_VPN-main/keyboards/inline/app_buttons.py b/files/TG_bot_VPN-main/keyboards/inline/app_buttons.py new file mode 100644 index 0000000..b62b0eb --- /dev/null +++ b/files/TG_bot_VPN-main/keyboards/inline/app_buttons.py @@ -0,0 +1,22 @@ +from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton + + +def get_apps_murkup(): + """ Inline buttons для выдачи ссылок на скачивание приложений """ + actions = InlineKeyboardMarkup(row_width=3) + + actions.add(InlineKeyboardButton(text="💻 Windows", url="https://github.com/hiddify/hiddify-next/releases/" + "download/v2.0.5/Hiddify-Windows-Setup-x64.exe"), + InlineKeyboardButton(text="🍏 MacOS", url="https://apps.apple.com/ru/app/" + "hiddify-proxy-vpn/id6596777532"), + InlineKeyboardButton(text="🐧 Linux", url="https://github.com/hiddify/hiddify-next/releases/" + "download/v2.0.5/Hiddify-Debian-x64.deb") + ) + actions.add(InlineKeyboardButton(text="📱 iOS", url="https://apps.apple.com/ru/app/" + "hiddify-proxy-vpn/id6596777532"), + InlineKeyboardButton(text="🤖 Android", url="https://play.google.com/store/" + "apps/details?id=app.hiddify.com") + ) + actions.add(InlineKeyboardButton(text="🔀 Другой вариант", url="https://github.com/hiddify/" + "hiddify-app/releases/tag/v2.0.5")) + return actions diff --git a/files/TG_bot_VPN-main/keyboards/inline/servers.py b/files/TG_bot_VPN-main/keyboards/inline/servers.py new file mode 100644 index 0000000..1b74b56 --- /dev/null +++ b/files/TG_bot_VPN-main/keyboards/inline/servers.py @@ -0,0 +1,19 @@ +from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton +from database.models import Server + + +def get_locations_markup(): + """ Inline buttons для выдачи всех локаций серверов """ + actions = InlineKeyboardMarkup(row_width=1) + servers_obj = Server.select() + for server in servers_obj: + actions.add(InlineKeyboardButton(text=f"🌍 {server.location}", callback_data=str(server.id))) + return actions + +def get_instruction_markup(): + """ Inline buttons для выдачи ссылки на инструкцию """ + actions = InlineKeyboardMarkup(row_width=1) + actions.add(InlineKeyboardButton(text="📖 Инструкция для подключения", url="https://telegra.ph/" + "Kak-ispolzovat-VPN-servis-" + "Guard-Tunnel-01-16")) + return actions diff --git a/files/TG_bot_VPN-main/keyboards/inline/subscribed.py b/files/TG_bot_VPN-main/keyboards/inline/subscribed.py new file mode 100644 index 0000000..e627494 --- /dev/null +++ b/files/TG_bot_VPN-main/keyboards/inline/subscribed.py @@ -0,0 +1,17 @@ +from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton +from config_data.config import CHANNEL_ID + + +def is_subscribed_markup(): + """ Inline buttons для проверки подписки """ + actions = InlineKeyboardMarkup(row_width=2) + actions.add(InlineKeyboardButton(text=f"Guard Tunnel VPN", url=f"https://t.me/{CHANNEL_ID[1:]}", + callback_data="1"), + InlineKeyboardButton(text=f" ✅ Я подписался", callback_data="2")) + return actions + +def get_renew_markup(vpn_key_id: int): + """Возвращает inline-клавиатуру с кнопкой «Продлить ключ».""" + markup = InlineKeyboardMarkup() + markup.add(InlineKeyboardButton(text="🔄 Продлить ключ", callback_data=f"renew_{vpn_key_id}")) + return markup diff --git a/files/TG_bot_VPN-main/keyboards/reply/__init__.py b/files/TG_bot_VPN-main/keyboards/reply/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/files/TG_bot_VPN-main/keyboards/reply/__init__.py diff --git a/files/TG_bot_VPN-main/keyboards/reply/handlers_reply.py b/files/TG_bot_VPN-main/keyboards/reply/handlers_reply.py new file mode 100644 index 0000000..a6149b0 --- /dev/null +++ b/files/TG_bot_VPN-main/keyboards/reply/handlers_reply.py @@ -0,0 +1,9 @@ +from telebot.types import ReplyKeyboardMarkup, KeyboardButton + + +def handlers_reply() -> ReplyKeyboardMarkup: + keyboard = ReplyKeyboardMarkup(True, False, row_width=2, + input_field_placeholder="Нажмите на нужную кнопку либо введите команду...") + keyboard.add(KeyboardButton('🌍 Серверы'), KeyboardButton('❓ Справка')) + keyboard.add(KeyboardButton('📖 Инструкция')) + return keyboard |
