Skip to content
Snippets Groups Projects
Commit b3018cfa authored by Tulir Asokan's avatar Tulir Asokan :cat2:
Browse files

Add logout command

parent 265fd90f
No related branches found
No related tags found
No related merge requests found
......@@ -95,6 +95,14 @@ async def enter_login_cookies(evt: CommandEvent) -> None:
evt.sender.command_status = None
@command_handler(needs_auth=True, help_section=SECTION_AUTH, help_text="Log out of Facebook")
async def logout(evt: CommandEvent) -> None:
puppet = pu.Puppet.get_by_fbid(evt.sender.uid)
await evt.sender.logout()
if puppet.is_real_user:
await puppet.switch_mxid(None, None)
@command_handler(needs_auth=True, management_only=True, help_args="<_access token_>",
help_section=SECTION_AUTH, help_text="Replace your Facebook Messenger account's "
"Matrix puppet with your Matrix account")
......
......@@ -145,6 +145,7 @@ class User(Client):
# endregion
async def logout(self) -> bool:
self.stopListening()
ok = await super().logout()
self._session_data = None
self._is_logged_in = False
......@@ -223,6 +224,7 @@ class User(Client):
:return: Whether the loop should keep running
"""
self.log.exception("Got exception while listening")
await asyncio.sleep(10)
return True
async def onMessage(self, mid: str = None, author_id: str = None, message: str = None,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment