mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-08-30 06:46:17 +00:00
Add files via upload
This commit is contained in:
parent
cb2d554dc5
commit
cc7ed3a682
1 changed files with 29 additions and 0 deletions
29
web/service/tls-checker.py
Normal file
29
web/service/tls-checker.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
import telegram
|
||||
import subprocess
|
||||
|
||||
# Replace YOUR_TOKEN with your bot token
|
||||
bot = telegram.Bot(token='6150347379:AAEKH1l5RIuiNtW9Xa4chKkRUzOUwEUxPlI')
|
||||
|
||||
# Define a function to send the VLESS config to the user
|
||||
def send_vless_config(chat_id):
|
||||
# Generate the VLESS config using the command-line tool v2ctl
|
||||
vless_config = subprocess.check_output(["v2ctl", "config"], universal_newlines=True)
|
||||
|
||||
# Send the VLESS config as a message to the user
|
||||
bot.send_message(chat_id=chat_id, text=vless_config)
|
||||
|
||||
# Add a handler for the /start command
|
||||
def start_handler(update: telegram.Update, context: telegram.ext.CallbackContext):
|
||||
chat_id = update.message.chat_id
|
||||
|
||||
# Call the send_vless_config function to send the VLESS config to the user
|
||||
send_vless_config(chat_id)
|
||||
|
||||
# Create a dispatcher and add the start_handler to handle the /start command
|
||||
dispatcher = telegram.ext.Dispatcher(bot, None, workers=0)
|
||||
dispatcher.add_handler(telegram.ext.CommandHandler('start', start_handler))
|
||||
|
||||
# Start the bot
|
||||
updater = telegram.ext.Updater(bot.token, use_context=True, workers=0)
|
||||
updater.dispatcher = dispatcher
|
||||
updater.start_polling()
|
Loading…
Reference in a new issue