Skip to content

feat: add Room.leave() method#79

Open
ishita-0301 wants to merge 1 commit into
Code-Society-Lab:mainfrom
ishita-0301:feature/room-leave-method
Open

feat: add Room.leave() method#79
ishita-0301 wants to merge 1 commit into
Code-Society-Lab:mainfrom
ishita-0301:feature/room-leave-method

Conversation

@ishita-0301

Copy link
Copy Markdown
Contributor

Closes #75

Added Room.leave() async method so bots can leave a room at runtime. Follows the same error-handling pattern as existing methods like kick_user and invite_user. Includes unit tests for success and error cases.

@PenguinBoi12

Copy link
Copy Markdown
Contributor

@ishita-0301 you need to fix the conflict before I start reviewing. Thank you!

@PenguinBoi12 PenguinBoi12 added the feature A new feature label Jul 2, 2026
Comment thread matrix/room.py
except Exception as e:
raise MatrixError(f"Failed to kick user: {e}")

async def leave(self) -> None:

@PenguinBoi12 PenguinBoi12 Jul 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A new way to handle matrix calls has been added. Basically, the whole body of the function would become:

await matrix_call( 
    self.client.room_leave(room_id=self.room_id),
    error_message="Failed to leave room"
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Room: Add leave method

2 participants