Skip to content

aron1cx/AIOFastTelethonHelper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AIOFastTelethonHelper

Asynchronous fork of FastTelethonhelper
Provides fully async and parallel file upload/download functions using aiofiles and non-blocking I/O.

📦 Installation

pip install aiofasttelethonhelper

⚙️ Usage Example

from aiofasttelethonhelper.utils import print_progress_bar
from aiofasttelethonhelper import fast_download, fast_upload
from telethon import TelegramClient

client = TelegramClient("session", API_ID, API_HASH)

def custom_progress_callback(**kwargs):
  done, total = kwargs.get('done'), kwargs.get('total')
  print(f"{done}/{total}")

async def main():
  async with client:
      file_path = await fast_download(
        client=client, 
        message=message, 
        file_path="./downloads", # or ./downloads/file.txt
        progress_callback=print_progress_bar
      )

      file = await fast_upload(
        client=client,
        file_path="input.txt",
        progress_callback=custom_progress_callback
      )
      await client.send_file("me", file)

❤️ Credits

  • Tulir Asokan - Original parallel transfer logic in mautrix-telegram
  • MiyukiKun - Original helper creator
  • Lonami - Creator of the amazing Telethon library

About

Async fork of fasttelethonhelper - rewritten with aiofiles to remove blocking I/O. Fully async, suitable for Telethon bots.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Python 100.0%