add info back in

This commit is contained in:
Will Tekulve 2016-04-01 19:42:29 -04:00
parent d6c9d0704f
commit 657d69f4cd

View File

@ -65,14 +65,18 @@ class Downloader:
msg += "\t{}\n".format(item) msg += "\t{}\n".format(item)
await self.bot.say(box(msg)) # Need to deal with over 2000 characters await self.bot.say(box(msg)) # Need to deal with over 2000 characters
'''@cog.command() @cog.command()
async def info(self, cog : str): async def info(self, repo_name: str, cog: str):
"""Shows info about the specified cog""" """Shows info about the specified cog"""
cogs = self.list_cogs() cogs = self.list_cogs(repo_name)
info_file = self.path + cog + "/info.json"
if cog in cogs: if cog in cogs:
info_file = os.path.join(cogs[cog].get('folder'), "info.json")
if os.path.isfile(info_file): if os.path.isfile(info_file):
try:
data = fileIO(info_file, "load") data = fileIO(info_file, "load")
except:
await self.bot.say('Error reading info file.')
return
msg = "{} by {}\n\n".format(cog, data["AUTHOR"]) msg = "{} by {}\n\n".format(cog, data["AUTHOR"])
msg += data["NAME"] + "\n\n" + data["DESCRIPTION"] msg += data["NAME"] + "\n\n" + data["DESCRIPTION"]
await self.bot.say(box(msg)) await self.bot.say(box(msg))
@ -80,7 +84,7 @@ class Downloader:
await self.bot.say("The specified cog has no info file.") await self.bot.say("The specified cog has no info file.")
else: else:
await self.bot.say("That cog doesn't exist." 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) @cog.command(hidden=True)
async def search(self, *terms: str): async def search(self, *terms: str):
@ -207,7 +211,7 @@ class Downloader:
self.repos[name][cog] = valid_cogs.get(cog, {}) self.repos[name][cog] = valid_cogs.get(cog, {})
self.repos[name][cog]['INSTALLED'] = False self.repos[name][cog]['INSTALLED'] = False
else: else:
self.repos[name][cog].update(cog) self.repos[name][cog].update(valid_cogs[cog])
self.save_repos() self.save_repos()
def update_repo(self, name): def update_repo(self, name):