From 657d69f4cd7e96fa478b9689afeedb8e2e4e611a Mon Sep 17 00:00:00 2001 From: Will Tekulve Date: Fri, 1 Apr 2016 19:42:29 -0400 Subject: [PATCH] add info back in --- cogs/downloader.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cogs/downloader.py b/cogs/downloader.py index 3ce64b404..7aefbfff3 100644 --- a/cogs/downloader.py +++ b/cogs/downloader.py @@ -65,14 +65,18 @@ class Downloader: msg += "\t{}\n".format(item) await self.bot.say(box(msg)) # Need to deal with over 2000 characters - '''@cog.command() - async def info(self, cog : str): + @cog.command() + async def info(self, repo_name: str, cog: str): """Shows info about the specified cog""" - cogs = self.list_cogs() - info_file = self.path + cog + "/info.json" + cogs = self.list_cogs(repo_name) if cog in cogs: + info_file = os.path.join(cogs[cog].get('folder'), "info.json") if os.path.isfile(info_file): - data = fileIO(info_file, "load") + try: + data = fileIO(info_file, "load") + except: + await self.bot.say('Error reading info file.') + return msg = "{} by {}\n\n".format(cog, data["AUTHOR"]) msg += data["NAME"] + "\n\n" + data["DESCRIPTION"] await self.bot.say(box(msg)) @@ -80,7 +84,7 @@ class Downloader: await self.bot.say("The specified cog has no info file.") else: await self.bot.say("That cog doesn't exist." - " Use cog list to see the full list.")''' + " Use cog list to see the full list.") @cog.command(hidden=True) async def search(self, *terms: str): @@ -207,7 +211,7 @@ class Downloader: self.repos[name][cog] = valid_cogs.get(cog, {}) self.repos[name][cog]['INSTALLED'] = False else: - self.repos[name][cog].update(cog) + self.repos[name][cog].update(valid_cogs[cog]) self.save_repos() def update_repo(self, name):