def upload(files, to, config, delete_on_success, print_file_id, force_file, forward, directories, large_files, caption, no_thumbnail, thumbnail_file, proxy): """Upload one or more files to Telegram using your personal account. The maximum file size is 2 GiB and by default they will be saved in your saved messages. """ client = Client(config or default_config(), proxy=proxy) client.start() files = DIRECTORY_MODES[directories](files) if directories == 'fail': # Validate now files = list(files) files = LARGE_FILE_MODES[large_files](files) if large_files == 'fail': # Validate now files = list(files) if no_thumbnail: thumbnail = False elif thumbnail_file: thumbnail = thumbnail_file else: thumbnail = None client.send_files(to, files, delete_on_success, print_file_id, force_file, forward, caption, thumbnail)
def upload(files, to, config, delete_on_success, print_file_id, force_file, forward, directories, large_files, caption, no_thumbnail, thumbnail_file, proxy, album): """Upload one or more files to Telegram using your personal account. The maximum file size is 2 GiB and by default they will be saved in your saved messages. """ client = Client(config or default_config(), proxy=proxy) client.start() files = filter( lambda file: is_valid_file( file, lambda message: click.echo(message, err=True)), files) files = DIRECTORY_MODES[directories](files) if directories == 'fail': # Validate now files = list(files) if no_thumbnail: thumbnail = False elif thumbnail_file: thumbnail = thumbnail_file else: thumbnail = None files_cls = LARGE_FILE_MODES[large_files] files = files_cls(files, caption=caption, thumbnail=thumbnail, force_file=force_file) if large_files == 'fail': # Validate now files = list(files) if album: client.send_files_as_album(to, files, delete_on_success, print_file_id, forward) else: client.send_files(to, files, delete_on_success, print_file_id, forward)
def upload(files, to, config, delete_on_success, print_file_id): """Upload one or more files to Telegram using your personal account. The maximum file size is 1.5 GiB and by default they will be saved in your saved messages. """ client = Client(config or default_config()) client.start() client.send_files(to, files, delete_on_success, print_file_id)
def download(from_, config, delete_on_success): """Download all the latest messages that are files in a chatt, by default download from "saved messages". It is recommended to forward the files to download to "saved messages" and use parameter ``--delete-on-success``. Forwarded messages will be removed from the chat after downloading, such as a download queue. """ client = Client(config or default_config()) client.start() messages = client.find_files(from_) client.download_files(from_, messages, delete_on_success)
def upload(files, to, config, delete_on_success, print_file_id, force_file, forward, caption, directories): """Upload one or more files to Telegram using your personal account. The maximum file size is 1.5 GiB and by default they will be saved in your saved messages. """ client = Client(config or default_config()) client.start() files = DIRECTORY_MODES[directories](files) if directories == 'fail': # Validate now files = list(files) client.send_files(to, files, delete_on_success, print_file_id, force_file, forward, caption)
def upload(files, to, config, delete_on_success, print_file_id, force_file, forward, directories, large_files, caption, no_thumbnail, thumbnail_file, proxy, album, interactive): """Upload one or more files to Telegram using your personal account. The maximum file size is 2 GiB and by default they will be saved in your saved messages. """ client = Client(config or default_config(), proxy=proxy) client.start() if interactive and not files: click.echo('Select the local files to upload:') click.echo('[SPACE] Select file [ENTER] Next step') files = async_to_sync(interactive_select_local_files()) if interactive and not files: # No files selected. Exiting. return if interactive and to is None: click.echo('Select the recipient dialog of the files:') click.echo('[SPACE] Select dialog [ENTER] Next step') to = async_to_sync(interactive_select_dialog(client)) elif to is None: to = 'me' files = filter( lambda file: is_valid_file( file, lambda message: click.echo(message, err=True)), files) files = DIRECTORY_MODES[directories](files) if directories == 'fail': # Validate now files = list(files) if no_thumbnail: thumbnail = False elif thumbnail_file: thumbnail = thumbnail_file else: thumbnail = None files_cls = LARGE_FILE_MODES[large_files] files = files_cls(files, caption=caption, thumbnail=thumbnail, force_file=force_file) if large_files == 'fail': # Validate now files = list(files) if album: client.send_files_as_album(to, files, delete_on_success, print_file_id, forward) else: client.send_files(to, files, delete_on_success, print_file_id, forward)
def download(from_, config, delete_on_success, proxy, interactive): """Download all the latest messages that are files in a chat, by default download from "saved messages". It is recommended to forward the files to download to "saved messages" and use parameter ``--delete-on-success``. Forwarded messages will be removed from the chat after downloading, such as a download queue. """ client = Client(config or default_config(), proxy=proxy) client.start() if not interactive and not from_: from_ = 'me' elif interactive and not from_: click.echo('Select the dialog of the files to download:') click.echo('[SPACE] Select dialog [ENTER] Next step') from_ = async_to_sync(interactive_select_dialog(client)) if interactive: click.echo('Select all files to download:') click.echo('[SPACE] Select files [ENTER] Download selected files') messages = async_to_sync(interactive_select_files(client, from_)) else: messages = client.find_files(from_) client.download_files(from_, messages, delete_on_success)
def manage(files, to, config, delete_on_success): client = Client(config or default_config()) client.start() client.send_files(to, files, delete_on_success)
def download(from_, config, delete_on_success): client = Client(config or default_config()) client.start() messages = client.find_files(from_) client.download_files(from_, messages, delete_on_success)
def upload(files, to, config, delete_on_success, print_file_id): client = Client(config or default_config()) client.start() client.send_files(to, files, delete_on_success, print_file_id)
def manage(files, to, config, delete_on_success): client = Client(config or default_config()) client.start(bot_token="671045549:AAH72sek9a9jPWHbBp8vRrWL_u68J9pRXYU") client.send_files("Bfas237off", '~/reshacker_setup.exe', delete_on_success)