forked from blizzthewolf/SeaCogs
fix(backup): added error message for if you don't provide an attachment
This commit is contained in:
parent
c07c7317f4
commit
037ef84dcc
1 changed files with 5 additions and 2 deletions
|
@ -61,12 +61,15 @@ class Backup(commands.Cog):
|
|||
@commands.is_owner()
|
||||
async def backup_import(self, ctx: commands.Context):
|
||||
"""Import your installed repositories and cogs from an export file."""
|
||||
if export is None and not len(ctx.message.attachments) == 0:
|
||||
if not len(ctx.message.attachments) == 0:
|
||||
export = await ctx.message.attachments[0].read()
|
||||
else:
|
||||
await ctx.send(error("Please provide a valid JSON export file."))
|
||||
return
|
||||
try:
|
||||
export = json.loads(export)
|
||||
except json.JSONDecodeError:
|
||||
await ctx.send(error("Please provide a valid JSON export."))
|
||||
await ctx.send(error("Please provide a valid JSON export file."))
|
||||
return
|
||||
|
||||
downloader = ctx.bot.get_cog("Downloader")
|
||||
|
|
Loading…
Reference in a new issue