Merge pull request #275 from SeyedHashtag/good
Enhance telegram bot user interface by adding emojies
This commit is contained in:
@ -16,7 +16,7 @@ def create_cancel_markup(back_step=None):
|
|||||||
markup.row(types.KeyboardButton("❌ Cancel"))
|
markup.row(types.KeyboardButton("❌ Cancel"))
|
||||||
return markup
|
return markup
|
||||||
|
|
||||||
@bot.message_handler(func=lambda message: is_admin(message.from_user.id) and message.text == 'Add User')
|
@bot.message_handler(func=lambda message: is_admin(message.from_user.id) and message.text == '➕ Add User')
|
||||||
def add_user(message):
|
def add_user(message):
|
||||||
msg = bot.reply_to(message, "Enter username (only letters, numbers, and underscores are allowed):", reply_markup=create_cancel_markup())
|
msg = bot.reply_to(message, "Enter username (only letters, numbers, and underscores are allowed):", reply_markup=create_cancel_markup())
|
||||||
bot.register_next_step_handler(msg, process_add_user_step1)
|
bot.register_next_step_handler(msg, process_add_user_step1)
|
||||||
|
|||||||
@ -11,7 +11,7 @@ from telebot import types
|
|||||||
from utils.command import *
|
from utils.command import *
|
||||||
|
|
||||||
|
|
||||||
@bot.message_handler(func=lambda message: is_admin(message.from_user.id) and message.text == 'Backup Server')
|
@bot.message_handler(func=lambda message: is_admin(message.from_user.id) and message.text == '💾 Backup Server')
|
||||||
def backup_server(message):
|
def backup_server(message):
|
||||||
bot.reply_to(message, "Starting backup. This may take a few moments...")
|
bot.reply_to(message, "Starting backup. This may take a few moments...")
|
||||||
bot.send_chat_action(message.chat.id, 'typing')
|
bot.send_chat_action(message.chat.id, 'typing')
|
||||||
|
|||||||
@ -2,7 +2,7 @@ from telebot import types
|
|||||||
|
|
||||||
def create_main_markup():
|
def create_main_markup():
|
||||||
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
|
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
|
||||||
markup.row('Add User', 'Show User')
|
markup.row('➕ Add User', '🔍 Show User')
|
||||||
markup.row('Delete User', 'Server Info')
|
markup.row('🗑️ Delete User', '🖥️ Server Info')
|
||||||
markup.row('Backup Server')
|
markup.row('💾 Backup Server')
|
||||||
return markup
|
return markup
|
||||||
|
|||||||
@ -9,7 +9,7 @@ def handle_cancel_delete(call):
|
|||||||
bot.edit_message_text("Operation canceled.", chat_id=call.message.chat.id, message_id=call.message.message_id)
|
bot.edit_message_text("Operation canceled.", chat_id=call.message.chat.id, message_id=call.message.message_id)
|
||||||
create_main_markup(call.message)
|
create_main_markup(call.message)
|
||||||
|
|
||||||
@bot.message_handler(func=lambda message: is_admin(message.from_user.id) and message.text == 'Delete User')
|
@bot.message_handler(func=lambda message: is_admin(message.from_user.id) and message.text == '🗑️ Delete User')
|
||||||
def delete_user(message):
|
def delete_user(message):
|
||||||
markup = types.InlineKeyboardMarkup()
|
markup = types.InlineKeyboardMarkup()
|
||||||
cancel_button = types.InlineKeyboardButton("❌ Cancel", callback_data="cancel_delete")
|
cancel_button = types.InlineKeyboardButton("❌ Cancel", callback_data="cancel_delete")
|
||||||
|
|||||||
@ -14,7 +14,7 @@ def handle_cancel_show_user(call):
|
|||||||
bot.edit_message_text("Operation canceled.", chat_id=call.message.chat.id, message_id=call.message.message_id)
|
bot.edit_message_text("Operation canceled.", chat_id=call.message.chat.id, message_id=call.message.message_id)
|
||||||
create_main_markup(call.message)
|
create_main_markup(call.message)
|
||||||
|
|
||||||
@bot.message_handler(func=lambda message: is_admin(message.from_user.id) and message.text == 'Show User')
|
@bot.message_handler(func=lambda message: is_admin(message.from_user.id) and message.text == '🔍 Show User')
|
||||||
def show_user(message):
|
def show_user(message):
|
||||||
markup = types.InlineKeyboardMarkup()
|
markup = types.InlineKeyboardMarkup()
|
||||||
cancel_button = types.InlineKeyboardButton("❌ Cancel", callback_data="cancel_show_user")
|
cancel_button = types.InlineKeyboardButton("❌ Cancel", callback_data="cancel_show_user")
|
||||||
@ -106,14 +106,14 @@ def process_show_user(message):
|
|||||||
bio.seek(0)
|
bio.seek(0)
|
||||||
|
|
||||||
markup = types.InlineKeyboardMarkup(row_width=3)
|
markup = types.InlineKeyboardMarkup(row_width=3)
|
||||||
markup.add(types.InlineKeyboardButton("Reset User", callback_data=f"reset_user:{actual_username}"),
|
markup.add(types.InlineKeyboardButton("🔄 Reset User", callback_data=f"reset_user:{actual_username}"),
|
||||||
types.InlineKeyboardButton("IPv6-URI", callback_data=f"ipv6_uri:{actual_username}"))
|
types.InlineKeyboardButton("🌐 IPv6-URI", callback_data=f"ipv6_uri:{actual_username}"))
|
||||||
markup.add(types.InlineKeyboardButton("Edit Username", callback_data=f"edit_username:{actual_username}"),
|
markup.add(types.InlineKeyboardButton("✏️ Edit Username", callback_data=f"edit_username:{actual_username}"),
|
||||||
types.InlineKeyboardButton("Edit Traffic Limit", callback_data=f"edit_traffic:{actual_username}"))
|
types.InlineKeyboardButton("📶 Edit Traffic", callback_data=f"edit_traffic:{actual_username}"))
|
||||||
markup.add(types.InlineKeyboardButton("Edit Expiration Days", callback_data=f"edit_expiration:{actual_username}"),
|
markup.add(types.InlineKeyboardButton("📅 Edit Expiration", callback_data=f"edit_expiration:{actual_username}"),
|
||||||
types.InlineKeyboardButton("Renew Password", callback_data=f"renew_password:{actual_username}"))
|
types.InlineKeyboardButton("🔑 Renew Password", callback_data=f"renew_password:{actual_username}"))
|
||||||
markup.add(types.InlineKeyboardButton("Renew Creation Date", callback_data=f"renew_creation:{actual_username}"),
|
markup.add(types.InlineKeyboardButton("🕒 Renew Creation Date", callback_data=f"renew_creation:{actual_username}"),
|
||||||
types.InlineKeyboardButton("Block User", callback_data=f"block_user:{actual_username}"))
|
types.InlineKeyboardButton("⛔ Block User", callback_data=f"block_user:{actual_username}"))
|
||||||
|
|
||||||
caption = formatted_details
|
caption = formatted_details
|
||||||
if uri_v4:
|
if uri_v4:
|
||||||
|
|||||||
@ -2,7 +2,7 @@ from dotenv import load_dotenv
|
|||||||
from telebot import types
|
from telebot import types
|
||||||
from utils.command import *
|
from utils.command import *
|
||||||
|
|
||||||
@bot.message_handler(func=lambda message: is_admin(message.from_user.id) and message.text == 'Server Info')
|
@bot.message_handler(func=lambda message: is_admin(message.from_user.id) and message.text == '🖥️ Server Info')
|
||||||
def server_info(message):
|
def server_info(message):
|
||||||
command = f"python3 {CLI_PATH} server-info"
|
command = f"python3 {CLI_PATH} server-info"
|
||||||
result = run_cli_command(command)
|
result = run_cli_command(command)
|
||||||
|
|||||||
Reference in New Issue
Block a user