mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Downloader] No more default repo
This commit is contained in:
parent
7e96e5ad69
commit
ede821c911
@ -18,6 +18,7 @@ NUM_THREADS = 4
|
|||||||
REPO_NONEX = 0x1
|
REPO_NONEX = 0x1
|
||||||
REPO_CLONE = 0x2
|
REPO_CLONE = 0x2
|
||||||
REPO_SAME = 0x4
|
REPO_SAME = 0x4
|
||||||
|
REPOS_LIST = "https://twentysix26.github.io/Red-Docs/red_cog_approved_repos/"
|
||||||
|
|
||||||
|
|
||||||
class UpdateError(Exception):
|
class UpdateError(Exception):
|
||||||
@ -117,7 +118,10 @@ class Downloader:
|
|||||||
|
|
||||||
@cog.command(name="list")
|
@cog.command(name="list")
|
||||||
async def _send_list(self, repo_name=None):
|
async def _send_list(self, repo_name=None):
|
||||||
"""Lists installable cogs"""
|
"""Lists installable cogs
|
||||||
|
|
||||||
|
Repositories list:
|
||||||
|
https://twentysix26.github.io/Red-Docs/red_cog_approved_repos/"""
|
||||||
retlist = []
|
retlist = []
|
||||||
if repo_name and repo_name in self.repos:
|
if repo_name and repo_name in self.repos:
|
||||||
msg = "Available cogs:\n"
|
msg = "Available cogs:\n"
|
||||||
@ -130,17 +134,23 @@ class Downloader:
|
|||||||
else:
|
else:
|
||||||
retlist.append([cog, ''])
|
retlist.append([cog, ''])
|
||||||
else:
|
else:
|
||||||
msg = "Available repos:\n"
|
if self.repos:
|
||||||
for repo_name in sorted(self.repos.keys()):
|
msg = "Available repos:\n"
|
||||||
data = self.get_info_data(repo_name)
|
for repo_name in sorted(self.repos.keys()):
|
||||||
if data:
|
data = self.get_info_data(repo_name)
|
||||||
retlist.append([repo_name, data.get("SHORT", "")])
|
if data:
|
||||||
else:
|
retlist.append([repo_name, data.get("SHORT", "")])
|
||||||
retlist.append([repo_name, ""])
|
else:
|
||||||
|
retlist.append([repo_name, ""])
|
||||||
|
else:
|
||||||
|
await self.bot.say("You haven't added a repository yet.\n"
|
||||||
|
"Start now! {}".format(REPOS_LIST))
|
||||||
|
return
|
||||||
|
|
||||||
col_width = max(len(row[0]) for row in retlist) + 2
|
col_width = max(len(row[0]) for row in retlist) + 2
|
||||||
for row in retlist:
|
for row in retlist:
|
||||||
msg += "\t" + "".join(word.ljust(col_width) for word in row) + "\n"
|
msg += "\t" + "".join(word.ljust(col_width) for word in row) + "\n"
|
||||||
|
msg += "\nRepositories list: {}".format(REPOS_LIST)
|
||||||
for page in pagify(msg, delims=['\n'], shorten_by=8):
|
for page in pagify(msg, delims=['\n'], shorten_by=8):
|
||||||
await self.bot.say(box(page))
|
await self.bot.say(box(page))
|
||||||
|
|
||||||
@ -626,13 +636,10 @@ def check_folders():
|
|||||||
|
|
||||||
|
|
||||||
def check_files():
|
def check_files():
|
||||||
repos = \
|
|
||||||
{'community': {'url': "https://github.com/Twentysix26/Red-Cogs.git"}}
|
|
||||||
|
|
||||||
f = "data/downloader/repos.json"
|
f = "data/downloader/repos.json"
|
||||||
if not dataIO.is_valid_json(f):
|
if not dataIO.is_valid_json(f):
|
||||||
print("Creating default data/downloader/repos.json")
|
print("Creating default data/downloader/repos.json")
|
||||||
dataIO.save_json(f, repos)
|
dataIO.save_json(f, {})
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user