Make Telethon files upload/download faster
Project description
FastTelethon helper
- Make use of FastTelethon to upload and download files improved the code and usage a bit
Usage:
Installation:
pip install FastTelethonhelper
Downloads:
- Usage
from FastTelethonhelper import fast_download
- When you need to download file,
downloaded_location = await fast_download(client, msg, reply, download_folder, progress_bar_function)
client
= Telegram Client(Required)msg
= The message object which has the file to be downloaded(Required)reply
= The message on which you want the progressbar(Optional)download_folder
= Location where you want file to be downloaded, defaults to ./downloads/ (Optional)progress_bar_function
= The function you want to use to display the string in progressbar, it needs to have 2 parameters done bytes and total bytes and must return a desired string, defaults to a function I wrote(Optional)
- The function returns the download location.
Uploads:
- Usage
from FastTelethonhelper import fast_upload
- When you need to upload file,
await fast_upload(client, file_location, reply, name, progress_bar_function)
client
= TelegramClient(Required)file_location
= Where the file is located(Required)reply
= The message object you want the progressbar to appear(Optional)name
= Name of the file you want while uploading(Optional)progress_bar_function
= The function you want to use to display the string in progressbar, it needs to have 2 parameters done bytes and total bytes and must return a desired string, defaults to a function I wrote(Optional)
- This function returns the file object which you can use in send_message in telethon example
await bot.send_message(file=<what this function returns>)
Credits
- MiyukiKun for getting this together
- Loonami for telethon
- Tulir Asokan for mautrix-telegram
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for FastTelethonhelper-1.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa168a0d16073ec90f95c25f166cafafbfd9bef88a603a2fd095bf5c3ec5d053 |
|
MD5 | 6673ed079c608acfe2f2d5ffc64f647b |
|
BLAKE2b-256 | adbe5dd66665cb2b474dd963ff70809ede5c31c8e27daf2b88acca00bbd87856 |