Get Started - Learn How To Make Your Bot!

Guides

Code Snippets

Get methods

Post methods

Web API

Useful links

List of all currently Free Items

List of Emotes

Highrise Bot SDK Changelog


Added on version 23.1.0b8

move_user_to_room(self, user_id: str, room_id: str) -> None:

This enables your bot to move user to another room, bots operator has to be owner of the second room.

⚙️ Use cases

Here’s an example on how to move an user using a “move <@user> <room>” command on chat:

async def on_chat(self, user: User, message: str) -> None:
        if message.startswith("move"):
            room_dictionary = {"room_1": "<insert here your room id>",
                               "room_2": "<insert here your room id>",}
            if user.username != "ItsVini":
                await self.highrise.chat("You do not have permission to use this command.")
                return
            parts = message.split()
            if len(parts) != 3:
                await self.highrise.chat("Invalid move command format.")
                return
            command, username, room = parts
            if "@" not in username:
                username = username
            else:
                username = username[1:]
            if room not in room_dictionary:
                await self.highrise.chat("Invalid room, please specify a valid room.")
                return
            #check if user is in room
            room_users = (await self.highrise.get_room_users()).content
            for room_user, pos in room_users:
                if room_user.username.lower() == username.lower():
                    user_id = room_user.id
                    break
            if "user_id" not in locals():
                await self.highrise.chat("User not found, please specify a valid user and coordinate")
                return
            #move user
            try:
                await self.highrise.move_user_to_room(user_id, room_dictionary[room])
            except Exception as e:
                await self.highrise.chat(f"Error: {e}")
                return

Here’s an step by step explanation on how this code works:

  1. async def on_chat(self, user: User, message: str) -> None::
  2. if message.startswith("move"):
  3. room_dictionary = {"room_1": "<insert here your room id>", "room_2": "<insert here your room id>",}
  4. if user.username != "ItsVini":
  5. parts = message.split()
  6. if len(parts) != 3:
  7. command, username, room = parts
  8. if "@" not in username:
  9. else:
  10. if room not in room_dictionary:
  11. (await self.highrise.get_room_users()).content
  12. for room_user, pos in room_users:
  13. if room_user.username.lower() == username.lower():
  14. if "user_id" not in locals():
  15. await self.highrise.move_user_to_room(user_id, room_dictionary[room]):
  16. except Exception as e::