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()