Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added auth with bot token and support for ids for --to #181

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Forden
Copy link

@Forden Forden commented Dec 30, 2022

Simple patch to allow using bot tokens to auth as a bot and use integer ids instead of only strings

Copy link
Owner

@Nekmo Nekmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is fine but documentation and tests are needed. Thanks!

@@ -150,6 +150,13 @@ def upload(files, to, config, delete_on_success, print_file_id, force_file, forw
to = async_to_sync(interactive_select_dialog(client))
elif to is None:
to = 'me'
elif to is not None:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is now unnecessary. Also, it doesn't follow the Python style rules. You should never use except without defining an exception. It is also preferable to validate numbers without using exceptions. The use of defining the variable _ is not necessary.

try:
return super().start(phone=phone, password=password, bot_token=bot_token, force_sms=force_sms,
first_name=first_name, last_name=last_name, max_attempts=max_attempts)
return super().start(phone=config.get('phone', None), password=config.get('password', None),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code must be prepared in case the token bot and the phone were on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants