diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index 76f17d5b9..69b5fc601 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -1142,6 +1142,9 @@ class Core(commands.Cog, CoreLogic): await ctx.send( _("A backup has been made of this instance. It is at {}.").format(backup_file) ) + if backup_file.stat().st_size > 8_000_000: + await ctx.send(_("This backup is to large to send via DM.")) + return await ctx.send(_("Would you like to receive a copy via DM? (y/n)")) pred = MessagePredicate.yes_or_no(ctx) @@ -1152,10 +1155,18 @@ class Core(commands.Cog, CoreLogic): else: if pred.result is True: await ctx.send(_("OK, it's on its way!")) - async with ctx.author.typing(): - await ctx.author.send( - _("Here's a copy of the backup"), file=discord.File(str(backup_file)) + try: + async with ctx.author.typing(): + await ctx.author.send( + _("Here's a copy of the backup"), + file=discord.File(str(backup_file)), + ) + except discord.Forbidden: + await ctx.send( + _("I don't seem to be able to DM you. Do you have closed DMs?") ) + except discord.HTTPException: + await ctx.send(_("I could not send the backup file.")) else: await ctx.send(_("OK then.")) else: