From 045d51bc237f02b1c0b3763e59f4e221350b24b1 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Wed, 31 Jan 2024 12:37:27 -0500 Subject: [PATCH] fix(backup): only try to access message attachments if the message has any --- backup/backup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backup/backup.py b/backup/backup.py index f296eca..c2066a4 100644 --- a/backup/backup.py +++ b/backup/backup.py @@ -61,8 +61,9 @@ class Backup(commands.Cog): async def backup_import(self, ctx: commands.Context, json: str = None): """Import your installed repositories and cogs from an export.""" if json is None: - json = await ctx.message.attachments[0].read() - if json is None: + if ctx.message.attachments is not None: + json = await ctx.message.attachments[0].read() + else: await ctx.send(error("Please provide a valid JSON export.")) return