mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Core Commands] Add patch for invalid path with [p]backup (#2626)
* Add patch
This commit is contained in:
parent
c1bee3fee5
commit
c79b5e6179
@ -6,6 +6,7 @@ import itertools
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import pathlib
|
||||||
import sys
|
import sys
|
||||||
import tarfile
|
import tarfile
|
||||||
import traceback
|
import traceback
|
||||||
@ -1166,6 +1167,12 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def backup(self, ctx: commands.Context, *, backup_path: str = None):
|
async def backup(self, ctx: commands.Context, *, backup_path: str = None):
|
||||||
"""Creates a backup of all data for the instance."""
|
"""Creates a backup of all data for the instance."""
|
||||||
|
if backup_path:
|
||||||
|
path = pathlib.Path(backup_path)
|
||||||
|
if not (path.exists() and path.is_dir()):
|
||||||
|
return await ctx.send(
|
||||||
|
_("That path doesn't seem to exist. Please provide a valid path.")
|
||||||
|
)
|
||||||
from redbot.core.data_manager import basic_config, instance_name
|
from redbot.core.data_manager import basic_config, instance_name
|
||||||
from redbot.core.drivers.red_json import JSON
|
from redbot.core.drivers.red_json import JSON
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user