fix(backup): only try to access message attachments if the message has any
This commit is contained in:
parent
35ffec9c3f
commit
045d51bc23
1 changed files with 3 additions and 2 deletions
|
@ -61,8 +61,9 @@ class Backup(commands.Cog):
|
||||||
async def backup_import(self, ctx: commands.Context, json: str = None):
|
async def backup_import(self, ctx: commands.Context, json: str = None):
|
||||||
"""Import your installed repositories and cogs from an export."""
|
"""Import your installed repositories and cogs from an export."""
|
||||||
if json is None:
|
if json is None:
|
||||||
|
if ctx.message.attachments is not None:
|
||||||
json = await ctx.message.attachments[0].read()
|
json = await ctx.message.attachments[0].read()
|
||||||
if json is None:
|
else:
|
||||||
await ctx.send(error("Please provide a valid JSON export."))
|
await ctx.send(error("Please provide a valid JSON export."))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue