Get Started - Learn How To Make Your Bot!
List of all currently Free Items
Added on version 23.1.0b5
get_room_privilege(self, user_id: str) -> RoomPermissions | Error:
Fetch the room privilege for given user_id.
This code snippet defines an asynchronous function called on_user_join
that takes in a user
object of type User
and returns None
. The function is used to handle when a user joins a room.
Within the function, there is an await
keyword which indicates that the function is performing an asynchronous operation. The await
keyword is used with a method call self.highrise.get_room_privilege(user.id)
which is a non-blocking method call that allows other code to continue executing while it waits for the method call to complete.
The get_room_privilege
method returns a privileges
object which is then printed to the console using the print
function along with the user.username
who just joined the room.
In summary, the on_user_join
function handles when a user joins a room, gets the user's room privileges using an asynchronous method call, and prints a message to the console indicating the user who joined and their privileges.
async def on_user_join(self, user: User,position: Position | AnchorPosition) -> None:
privileges = await self.highrise.get_room_privilege(user.id)
print(f"{user.username} joined the room with the privileges {privileges}")