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

Friendly method needed for online/offline status #513

Open
chen97 opened this issue Oct 8, 2020 · 2 comments
Open

Friendly method needed for online/offline status #513

chen97 opened this issue Oct 8, 2020 · 2 comments

Comments

@chen97
Copy link

@chen97 chen97 commented Oct 8, 2020

Checklist

  • Online status can be hide when non-working hours.
  • Can be always online even if you are not opening telegram or group chat.

Description

I believe currently do not have a function to set myself as online or offline when doing the task by using Pyrogram.
It is quite useful and detailed function if I am able to control the status when using Pyrogram. Thank you for your consideration.

@delivrance
Copy link
Member

@delivrance delivrance commented Oct 23, 2020

I'll keep this open until a convenience method is added. For now you can use the raw method account.UpdateStatus:

from pyrogram.raw import functions

...

# Go online explicitly
app.send(functions.account.UpdateStatus(offline=False))

# Go offline explicitly
app.send(functions.account.UpdateStatus(offline=True))

Keep in mind that sending messages or doing public actions will automatically put you online. Receiving messages alone will not trigger the online status.

@chen97
Copy link
Author

@chen97 chen97 commented Oct 24, 2020

@delivrance Thank you so much for the solution to solve my problem facing now.

@delivrance delivrance changed the title Status to be offline when on_message listening Friendly method needed for online/offline status Oct 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.