[exceptions] only create discord thread in except block if thread doesn't already exist; post inside either way (addresses an earlier bug)
Browse files
app.py
CHANGED
|
@@ -420,7 +420,8 @@ async def deepfloydif(ctx, *, prompt: str):
|
|
| 420 |
|
| 421 |
except Exception as e:
|
| 422 |
print(f"Error: {e}")
|
| 423 |
-
thread
|
|
|
|
| 424 |
await thread.send(f"{ctx.author.mention} Encountered error while posting combined image in thread.")
|
| 425 |
await fullqueue(e, thread)
|
| 426 |
await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
|
|
@@ -429,7 +430,8 @@ async def deepfloydif(ctx, *, prompt: str):
|
|
| 429 |
#deepfloydif try/except
|
| 430 |
except Exception as e:
|
| 431 |
print(f"Error: {e}")
|
| 432 |
-
thread
|
|
|
|
| 433 |
await thread.send(f"{ctx.author.mention} Overall error with deepfloydif.")
|
| 434 |
await fullqueue(e, thread)
|
| 435 |
await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
|
|
|
|
| 420 |
|
| 421 |
except Exception as e:
|
| 422 |
print(f"Error: {e}")
|
| 423 |
+
if thread is Null:
|
| 424 |
+
thread = await ctx.message.create_thread(name=f'Posting Error')
|
| 425 |
await thread.send(f"{ctx.author.mention} Encountered error while posting combined image in thread.")
|
| 426 |
await fullqueue(e, thread)
|
| 427 |
await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
|
|
|
|
| 430 |
#deepfloydif try/except
|
| 431 |
except Exception as e:
|
| 432 |
print(f"Error: {e}")
|
| 433 |
+
if thread is Null:
|
| 434 |
+
thread = await ctx.message.create_thread(name=f'deepfloydif Error')
|
| 435 |
await thread.send(f"{ctx.author.mention} Overall error with deepfloydif.")
|
| 436 |
await fullqueue(e, thread)
|
| 437 |
await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
|