From 224a01ad89ec281d8052dbc344204334ae08f2fc Mon Sep 17 00:00:00 2001 From: Valerie Date: Mon, 26 May 2025 20:21:26 -0400 Subject: [PATCH] Enhance shop item creation process to support new shop creation. Update user prompts to inform about existing shops and allow for the creation of new shops if none exist. Streamline message handling and improve user experience during item addition. --- shop/shop.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/shop/shop.py b/shop/shop.py index 2800b9d..4fdba1d 100644 --- a/shop/shop.py +++ b/shop/shop.py @@ -1641,12 +1641,25 @@ class ItemManager: msg = "What shop would you like to add this item to?\n" shops = await self.instance.Shops() - msg += "Current shops are: " - msg += humanize_list([f"`{shopname}`" for shopname in sorted(shops.keys())]) + if shops: + msg += "Current shops are: " + msg += humanize_list([f"`{shopname}`" for shopname in sorted(shops.keys())]) + msg += "\nYou can also enter a new shop name to create a new shop." + else: + msg += "No shops exist yet. Enter a name for your new shop." await self.ctx.send(msg) - shop = await self.ctx.bot.wait_for("message", timeout=25, check=Checks(self.ctx, custom=shops.keys()).content) - await self.add(data, shop.content, name) - await self.ctx.send("Item creation complete. Check your logs to ensure it went to the approriate shop.") + + # Remove the check for existing shops to allow new shop creation + shop = await self.ctx.bot.wait_for("message", timeout=25, check=Checks(self.ctx, length=25).length_under) + + if shop.content not in shops: + # Create new shop with @everyone role + async with self.instance.Shops() as shops: + shops[shop.content] = {"Items": {}, "Role": "@everyone"} + await self.ctx.send(f"Created new shop: {shop.content}") + + await self.add(data, shop.content, name, new_allowed=True) + await self.ctx.send("Item creation complete. Check your logs to ensure it went to the appropriate shop.") async def delete(self): shop_list = await self.instance.Shops.all()