From 0debc03ec8af5d4c686e2fd6258e50872f3d3acd Mon Sep 17 00:00:00 2001 From: SimolZimol <70102430+SimolZimol@users.noreply.github.com> Date: Fri, 29 Aug 2025 17:32:18 +0200 Subject: [PATCH] modified: bot.py --- bot.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/bot.py b/bot.py index 1572729..b6d7b46 100644 --- a/bot.py +++ b/bot.py @@ -2524,7 +2524,7 @@ async def speech_to_text(ctx, *, audio_attachment: discord.Attachment = None): # Helper function for sending responses async def send_response(content=None, embed=None, ephemeral=False): try: - if is_slash_command: + if is_slash_command and hasattr(ctx, 'followup'): if embed: await ctx.followup.send(embed=embed, ephemeral=ephemeral) else: @@ -2535,11 +2535,15 @@ async def speech_to_text(ctx, *, audio_attachment: discord.Attachment = None): else: await ctx.send(content) except Exception as e: - logger.error(f"Error sending response: {e}") + logger.error(f"Error sending response in speech_to_text: {e}") + # Fallback to regular send if followup fails try: - await ctx.send(f"Error: {e}") - except: - pass + if embed: + await ctx.send(embed=embed) + else: + await ctx.send(content) + except Exception as fallback_error: + logger.error(f"Fallback send also failed: {fallback_error}") try: # Get attachment (either from parameter or message) @@ -2745,7 +2749,7 @@ async def live_speech(ctx, duration: int = 10): # Helper function for sending responses async def send_response(content=None, embed=None, ephemeral=False): try: - if is_slash_command: + if is_slash_command and hasattr(ctx, 'followup'): if embed: await ctx.followup.send(embed=embed, ephemeral=ephemeral) else: @@ -2756,7 +2760,15 @@ async def live_speech(ctx, duration: int = 10): else: await ctx.send(content) except Exception as e: - logger.error(f"Error sending response: {e}") + logger.error(f"Error sending response in live_speech: {e}") + # Fallback to regular send if followup fails + try: + if embed: + await ctx.send(embed=embed) + else: + await ctx.send(content) + except Exception as fallback_error: + logger.error(f"Fallback send also failed: {fallback_error}") try: # Validate duration