mirror of
https://github.com/alfem/telegram-download-daemon.git
synced 2025-03-02 00:56:20 +08:00
a little help with available commands
This commit is contained in:
parent
b0bfc081fc
commit
d5151e2477
1 changed files with 12 additions and 6 deletions
|
@ -20,6 +20,9 @@ import multiprocessing
|
||||||
import argparse
|
import argparse
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
|
|
||||||
|
TDD_VERSION="1.1"
|
||||||
|
|
||||||
TELEGRAM_DAEMON_API_ID = getenv("TELEGRAM_DAEMON_API_ID")
|
TELEGRAM_DAEMON_API_ID = getenv("TELEGRAM_DAEMON_API_ID")
|
||||||
TELEGRAM_DAEMON_API_HASH = getenv("TELEGRAM_DAEMON_API_HASH")
|
TELEGRAM_DAEMON_API_HASH = getenv("TELEGRAM_DAEMON_API_HASH")
|
||||||
TELEGRAM_DAEMON_CHANNEL = getenv("TELEGRAM_DAEMON_CHANNEL")
|
TELEGRAM_DAEMON_CHANNEL = getenv("TELEGRAM_DAEMON_CHANNEL")
|
||||||
|
@ -89,6 +92,7 @@ proxy = None
|
||||||
async def sendHelloMessage(client, peerChannel):
|
async def sendHelloMessage(client, peerChannel):
|
||||||
entity = await client.get_entity(peerChannel)
|
entity = await client.get_entity(peerChannel)
|
||||||
print("Hi! Ready for your files!")
|
print("Hi! Ready for your files!")
|
||||||
|
await client.send_message(entity, "Telegram Download Daemon "+TDD_VERSION)
|
||||||
await client.send_message(entity, "Hi! Ready for your files!")
|
await client.send_message(entity, "Hi! Ready for your files!")
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,18 +146,20 @@ with TelegramClient(getSession(), api_id, api_hash,
|
||||||
|
|
||||||
if command == "list":
|
if command == "list":
|
||||||
output = subprocess.run(["ls -l "+downloadFolder], shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,encoding="utf-8").stdout
|
output = subprocess.run(["ls -l "+downloadFolder], shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,encoding="utf-8").stdout
|
||||||
|
elif command == "status":
|
||||||
if command == "status":
|
|
||||||
try:
|
try:
|
||||||
output = "".join([ f"{key}: {value}\n" for (key, value) in in_progress.items()])
|
output = "".join([ f"{key}: {value}\n" for (key, value) in in_progress.items()])
|
||||||
if output: output = "Active downloads:\n\n" + output
|
if output:
|
||||||
else: output = "No active downloads"
|
output = "Active downloads:\n\n" + output
|
||||||
|
else:
|
||||||
|
output = "No active downloads"
|
||||||
except:
|
except:
|
||||||
output = "Some error occured while checking the status. Retry."
|
output = "Some error occured while checking the status. Retry."
|
||||||
|
elif command == "clean":
|
||||||
if command == "clean":
|
|
||||||
output = "Cleaning "+tempFolder+"\n"
|
output = "Cleaning "+tempFolder+"\n"
|
||||||
output+=subprocess.run(["rm "+tempFolder+"/*."+TELEGRAM_DAEMON_TEMP_SUFFIX], shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,encoding="utf-8").stdout
|
output+=subprocess.run(["rm "+tempFolder+"/*."+TELEGRAM_DAEMON_TEMP_SUFFIX], shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,encoding="utf-8").stdout
|
||||||
|
else:
|
||||||
|
output = "Available commands: list, status, clean"
|
||||||
|
|
||||||
await log_reply(event, output)
|
await log_reply(event, output)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue