modified: bot.py
This commit is contained in:
26
bot.py
26
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
|
||||
|
||||
Reference in New Issue
Block a user