Skip to content

Commit

Permalink
fix download bug with userid
Browse files Browse the repository at this point in the history
  • Loading branch information
iw4p committed Jun 26, 2021
1 parent f743478 commit 3616142
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -10,8 +10,8 @@
# This call to setup() does all the work
setup(
name="telegram-cloud",
version="1.4.3",
description="Download and upload files via telegram up to 1.5GB, CLI",
version="1.4.4",
description="Download and upload files via telegram up to 2 GB, CLI",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/iw4p/telegram-cloud",
Expand Down
44 changes: 44 additions & 0 deletions snippet.txt
@@ -0,0 +1,44 @@
cd funniest
python3 setup.py sdist bdist_wheel\n
cd Desktop/funniestnima
rm -rf funniestnima.egg-info build dist
python3 setup.py sdist bdist_wheel
python3 -m twine check dist/*
python3 -m twine upload dist/*
pip install funniestnima==0.2

dev package

python3 -m pip uninstall -e .
pip3 uninstall telegram-cloud
python3 setup.py sdist
pip3 list
python3 setup.py bdist_wheel
ls -ltrh
pip3 install -e .
pip3 uninstall telegram-cloud
pip3 install -e .

# Search in chats for sending Retrieving
"""
This function is good for searching between all conversations without knowing the telegram Username or telegram UserID
But it is not useful and enable, maybe later, maybe never
"""
# async def chat_iter(client, search_for_name):
# my_private_channel_id = None
# my_private_channel = None

# async for dialog in client.iter_dialogs():
# if dialog.name == search_for_name:
# my_private_channel = dialog
# my_private_channel_id = dialog.id
# break

# print(my_private_channel)
# print(my_private_channel_id)
# if search_for_name is None:
# return "chat not found"
# else:
# return my_private_channel_id

# conversation_name = await chat_iter(client, username)
5 changes: 4 additions & 1 deletion telegramcloud/__main__.py
Expand Up @@ -33,19 +33,22 @@ def download_callback(current, total):
def upload_callback(current, total):
print('Uploaded', current, 'out of', total, 'bytes: {:.2%}'.format(current / total))


async def main():

# Get target username
username = args.username

target_chat = await target_username_handler(client, username)

# Retrieve and download a file from its name or caption, from specific target_chat
if args.mode == 'download':
if args.caption and args.path and username:
async for message in client.iter_messages(entity=username, search=args.caption):
async for message in client.iter_messages(entity=target_chat, search=args.caption):
try:
await client.download_media(message, args.path, progress_callback=download_callback)
except:
print('ridam')
pass


Expand Down

0 comments on commit 3616142

Please sign in to comment.