🩴 Buy_item

🩴 Buy_item

Added on version 23.3.0
buy_item(self, item_id: str) -> Literal["success", "insufficient_funds"] | Error:
Buy an item.
It takes item id and attempts to buy this item from highrise. Note bot can only use his own wallet to buy items. Some items are not available for purchase. Take note that bots can only equip those items and not trade them, there is no use in buying items more than one time.

βš™οΈ Use cases

Here’s a simple example where whe say a command and the item id from the item we want to buy:
async def on_chat(self, user: User, message: str) -> None: if message.lower().startswith("/buy "): parts = message.split(" ") if len(parts) != 2: await self.highrise.chat("Invalid command") return item_id = parts[1] try: response = await self.highrise.buy_item(item_id) await self.highrise.chat(f"Item bought: {response}") except Exception as e: await self.highrise.chat(f"Error: {e}")
notion image
Β 
Β 
Built with Potion.so