From a91a6f29515b6f485fdb5fba2b50af85fe443f0b Mon Sep 17 00:00:00 2001 From: bobloy Date: Fri, 26 Oct 2018 08:54:06 -0400 Subject: [PATCH] Gotta upload the fixes --- recyclingplant/recyclingplant.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/recyclingplant/recyclingplant.py b/recyclingplant/recyclingplant.py index 2b08633..7f8f326 100644 --- a/recyclingplant/recyclingplant.py +++ b/recyclingplant/recyclingplant.py @@ -1,12 +1,11 @@ import asyncio import json import random - -from redbot.core import bank -from redbot.core import commands -from redbot.core.data_manager import cog_data_path, bundled_data_path from typing import Any +from redbot.core import bank, commands +from redbot.core.data_manager import bundled_data_path + Cog: Any = getattr(commands, "Cog", object) @@ -15,18 +14,21 @@ class RecyclingPlant(Cog): def __init__(self, bot): self.bot = bot - # self.path = str(cog_data_path(self)).replace("\\", "/") - # self.junk_path = self.path + "/bundled_data/junk.json" - self.path = str(bundled_data_path(self)).replace("\\", "/") - print(self.path) - self.junk_path = self.path + "/junk.json" - with open(self.junk_path) as json_data: + self.junk_path = bundled_data_path(self) / "junk.json" + + self.junk = None + + def load_junk(self): + with self.junk_path.open() as json_data: self.junk = json.load(json_data) @commands.command(aliases=["recycle"]) async def recyclingplant(self, ctx: commands.Context): """Apply for a job at the recycling plant!""" + if self.junk is None: + self.load_junk() + x = 0 reward = 0 await ctx.send(