Skip to content

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

Open
Forden wants to merge 3 commits into
Nekmo:masterfrom
Forden:master
Open

Added auth with bot token and support for ids for --to#181
Forden wants to merge 3 commits into
Nekmo:masterfrom
Forden:master

Conversation

@Forden

@Forden Forden commented Dec 30, 2022

Copy link
Copy Markdown

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

@Nekmo Nekmo left a comment

Copy link
Copy Markdown
Owner

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!

to = async_to_sync(interactive_select_dialog(client))
elif to is None:
to = 'me'
elif to is not None:

Copy link
Copy Markdown
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.

Comment thread telegram_upload/client.py
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
Copy Markdown
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