fix(backup): doing some cleanup

This commit is contained in:
Seaswimmer 2024-01-31 15:48:23 -05:00
parent 4e70145d38
commit 22237a21b1
Signed by untrusted user: cswimr
GPG key ID: B8953EC01E5C4063
2 changed files with 9 additions and 3 deletions

View file

@ -20,6 +20,6 @@ Exports a JSON list of all of your added repositories, and their installed cogs.
### backup import ### backup import
- Usage: `[p]backup import [json]` - Usage: `[p]backup import`
Imports, reinstalls, and reloads cogs from a valid export. Requires the JSON export to be attached to the invoking message as an attachment. Ignores itself and PyLav cogs. Reinstalls repositories and cogs from a valid export. Requires the JSON export to be attached to the invoking message as an attachment. Ignores itself and PyLav cogs, due to possible conflicts with Docker images.

View file

@ -59,7 +59,9 @@ class Backup(commands.Cog):
if cog.repo_name == repo.name: if cog.repo_name == repo.name:
cog_dict = { cog_dict = {
"name": cog.name, "name": cog.name,
"loaded": ctx.bot.get_cog(cog.name) is not None, # "loaded": cog.name in ctx.bot.extensions.keys(),
# this functionality was planned but never implemented due to Red limitations
# and the possibility of restoration functionality being added to Core
"pinned": cog.pinned, "pinned": cog.pinned,
"commit": cog.commit "commit": cog.commit
} }
@ -178,6 +180,10 @@ class Backup(commands.Cog):
else: else:
commit = None commit = None
# If you're forking this cog, make sure to change these strings!
if cog_name == 'backup' and 'SeaswimmerTheFsh/SeaCogs' in url:
continue
async with repository.checkout(commit, exit_to_rev=repository.branch): async with repository.checkout(commit, exit_to_rev=repository.branch):
cogs_c, message = await downloader._filter_incorrect_cogs_by_names(repository, [cog_name]) # pylint: disable=protected-access cogs_c, message = await downloader._filter_incorrect_cogs_by_names(repository, [cog_name]) # pylint: disable=protected-access
if not cogs_c: if not cogs_c: