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

async/await syntax #93

Open
Pegorino82 opened this issue Mar 26, 2020 · 4 comments
Open

async/await syntax #93

Pegorino82 opened this issue Mar 26, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@Pegorino82
Copy link

is it possible to use async/await with the library?
if it is, does any have examples of usage?
it will be greate for me)

@alexander-akhmetov
Copy link
Owner

Hi,

No, the library officially doesn't support async/await syntax, you'll have to write a wrapper if you want to use it.

@nicolas17
Copy link

After seeing this, I thought it should be possible to use async/await with tdlib. So I tried it and I managed to get a low-level async tdjson wrapper working; by low-level I mean:
await tdlib.send_request({'@type': 'sendMessage', ...})

However, looking at the current API of python-telegram and how it's implemented, I don't think it would be possible to support async/await and keep compatibility with the existing API...

@alexander-akhmetov alexander-akhmetov added the enhancement New feature or request label May 14, 2020
@alexander-akhmetov
Copy link
Owner

Probably, it should be possible to have both the current synchronous client and a new async API, and the synchronous client could be migrated to use the new async-await API under the hood

@nicolas17
Copy link

This is what I wrote, in case it helps: https://gist.github.com/nicolas17/c8330da13512c9743a3da4b7c7688a3b

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

No branches or pull requests

3 participants