From 0835d849fc4c3bbaca7152e34257772531163eb4 Mon Sep 17 00:00:00 2001 From: Rene Teigen Date: Thu, 5 Jan 2023 21:41:05 +0000 Subject: [PATCH] Add fallback if guild is None --- models/openai_model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/models/openai_model.py b/models/openai_model.py index f5bf94b..5e73654 100644 --- a/models/openai_model.py +++ b/models/openai_model.py @@ -534,7 +534,10 @@ class Model: # Print the filesize of new_im, in mega bytes image_size = os.path.getsize(temp_file.name) / 1048576 - guild_file_limit = ctx.guild.filesize_limit / 1048576 + if ctx.guild is None: + guild_file_limit = 8 + else: + guild_file_limit = ctx.guild.filesize_limit / 1048576 # If the image size is greater than 8MB, we can't return this to the user, so we will need to downscale the # image and try again