def test_deleteItem_success(self): ItemUtil.createItem(guild_id=1, item_name="hello", item_type=ItemType.ATTACK, buff_type=1, buff_value=-1, buff_round=2, level_required=0, price=1) ItemUtil.deleteItem(guild_id=1, item_name="hello") result = ItemUtil.ListAllItem(guild_id=1) assert result == []
def test_deleteItem_failed_noItem(self): ItemUtil.deleteItem(guild_id=1, item_name="hello") result = ItemUtil.ListAllItem(guild_id=1) assert result == []
async def delete_item(self, ctx: commands.Command, item_name: str): result = ItemUtil.deleteItem(ctx.guild.id, item_name) if result == -1: await ctx.send("找不到該item,請確認名稱是否輸入錯誤!") else: await ctx.send(f"{item_name} 已被成功刪除!")