feat(cli): add telegram bot backup interval management

This commit is contained in:
ReturnFI
2025-09-18 11:55:17 +00:00
parent b583894d9a
commit 9f82486785
2 changed files with 26 additions and 9 deletions

View File

@ -566,17 +566,27 @@ def warp_status() -> str | None:
return run_cmd(['python3', Command.STATUS_WARP.value])
def start_telegram_bot(token: str, adminid: str):
def start_telegram_bot(token: str, adminid: str, backup_interval: str = None):
'''Starts the Telegram bot.'''
if not token or not adminid:
raise InvalidInputError('Error: Both --token and --adminid are required for the start action.')
run_cmd(['python3', Command.INSTALL_TELEGRAMBOT.value, 'start', token, adminid])
command = ['python3', Command.INSTALL_TELEGRAMBOT.value, 'start', token, adminid]
if backup_interval:
command.append(backup_interval)
run_cmd(command)
def stop_telegram_bot():
'''Stops the Telegram bot.'''
run_cmd(['python3', Command.INSTALL_TELEGRAMBOT.value, 'stop'])
def set_telegram_bot_backup_interval(backup_interval: str):
'''Sets the backup interval for the Telegram bot.'''
if not backup_interval:
raise InvalidInputError('Error: Backup interval is required.')
run_cmd(['python3', Command.INSTALL_TELEGRAMBOT.value, 'set_backup_interval', backup_interval])
def start_singbox(domain: str, port: int):
'''Starts Singbox.'''