modified: bot.py
This commit is contained in:
94
bot.py
94
bot.py
@@ -3773,16 +3773,24 @@ async def account(ctx, user: discord.User = None):
|
||||
async def send_response(content=None, embed=None, ephemeral=False, file=None):
|
||||
try:
|
||||
if is_slash_command:
|
||||
await ctx.followup.send(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
if hasattr(ctx, 'followup') and ctx.followup:
|
||||
await ctx.followup.send(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
elif hasattr(ctx, 'response') and not ctx.response.is_done():
|
||||
await ctx.response.send_message(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
else:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
else:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
except Exception as e:
|
||||
logger.error(f"Error sending response: {e}")
|
||||
# Fallback to regular send if followup fails
|
||||
logger.error(f"Error sending response in account command: {e}")
|
||||
# Final fallback - try basic send
|
||||
try:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
except:
|
||||
pass
|
||||
if embed:
|
||||
await ctx.send(embed=embed)
|
||||
elif content:
|
||||
await ctx.send(content=content)
|
||||
except Exception as fallback_error:
|
||||
logger.error(f"Fallback send also failed: {fallback_error}")
|
||||
|
||||
try:
|
||||
# Determine target user (self or specified user for moderators)
|
||||
@@ -4172,11 +4180,16 @@ async def viewwarn(ctx, warning_id: int):
|
||||
async def send_response(content=None, embed=None, ephemeral=False, file=None):
|
||||
try:
|
||||
if is_slash_command:
|
||||
await ctx.followup.send(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
if hasattr(ctx, 'followup') and ctx.followup:
|
||||
await ctx.followup.send(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
elif hasattr(ctx, 'response') and not ctx.response.is_done():
|
||||
await ctx.response.send_message(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
else:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
else:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
except Exception as e:
|
||||
logger.error(f"Error sending response: {e}")
|
||||
logger.error(f"Error sending response in viewwarn command: {e}")
|
||||
# Fallback to regular send if followup fails
|
||||
try:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
@@ -4372,11 +4385,16 @@ async def removewarn(ctx, warning_id: int):
|
||||
async def send_response(content=None, embed=None, ephemeral=False, file=None):
|
||||
try:
|
||||
if is_slash_command:
|
||||
await ctx.followup.send(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
if hasattr(ctx, 'followup') and ctx.followup:
|
||||
await ctx.followup.send(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
elif hasattr(ctx, 'response') and not ctx.response.is_done():
|
||||
await ctx.response.send_message(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
else:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
else:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
except Exception as e:
|
||||
logger.error(f"Error sending response: {e}")
|
||||
logger.error(f"Error sending response in removewarn command: {e}")
|
||||
try:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
except:
|
||||
@@ -4485,11 +4503,16 @@ async def restorewarn(ctx, warning_id: int):
|
||||
async def send_response(content=None, embed=None, ephemeral=False, file=None):
|
||||
try:
|
||||
if is_slash_command:
|
||||
await ctx.followup.send(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
if hasattr(ctx, 'followup') and ctx.followup:
|
||||
await ctx.followup.send(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
elif hasattr(ctx, 'response') and not ctx.response.is_done():
|
||||
await ctx.response.send_message(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
else:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
else:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
except Exception as e:
|
||||
logger.error(f"Error sending response: {e}")
|
||||
logger.error(f"Error sending response in restorewarn command: {e}")
|
||||
try:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
except:
|
||||
@@ -4621,16 +4644,24 @@ async def mute(ctx, user: discord.User, duration: str, reason: str = "No reason
|
||||
async def send_response(content=None, embed=None, ephemeral=False, file=None):
|
||||
try:
|
||||
if is_slash_command:
|
||||
await ctx.followup.send(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
if hasattr(ctx, 'followup') and ctx.followup:
|
||||
await ctx.followup.send(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
elif hasattr(ctx, 'response') and not ctx.response.is_done():
|
||||
await ctx.response.send_message(content=content, embed=embed, ephemeral=ephemeral, file=file)
|
||||
else:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
else:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
except Exception as e:
|
||||
logger.error(f"Error sending response: {e}")
|
||||
# Fallback to regular send if followup fails
|
||||
logger.error(f"Error sending response in mute command: {e}")
|
||||
# Final fallback - try basic send
|
||||
try:
|
||||
await ctx.send(content=content, embed=embed, file=file)
|
||||
except:
|
||||
pass
|
||||
if embed:
|
||||
await ctx.send(embed=embed)
|
||||
elif content:
|
||||
await ctx.send(content=content)
|
||||
except Exception as fallback_error:
|
||||
logger.error(f"Fallback send also failed: {fallback_error}")
|
||||
|
||||
try:
|
||||
# Parse message ID and context range from reason if they look valid
|
||||
@@ -5291,17 +5322,36 @@ async def addnotes(ctx, type: str, source: str = None, attachment: discord.Attac
|
||||
async def send_response(content=None, embed=None, ephemeral=False):
|
||||
try:
|
||||
if is_slash_command:
|
||||
if embed:
|
||||
await ctx.followup.send(embed=embed, ephemeral=ephemeral)
|
||||
if hasattr(ctx, 'followup') and ctx.followup:
|
||||
if embed:
|
||||
await ctx.followup.send(embed=embed, ephemeral=ephemeral)
|
||||
else:
|
||||
await ctx.followup.send(content, ephemeral=ephemeral)
|
||||
elif hasattr(ctx, 'response') and not ctx.response.is_done():
|
||||
if embed:
|
||||
await ctx.response.send_message(embed=embed, ephemeral=ephemeral)
|
||||
else:
|
||||
await ctx.response.send_message(content, ephemeral=ephemeral)
|
||||
else:
|
||||
await ctx.followup.send(content, ephemeral=ephemeral)
|
||||
if embed:
|
||||
await ctx.send(embed=embed)
|
||||
else:
|
||||
await ctx.send(content)
|
||||
else:
|
||||
if embed:
|
||||
await ctx.send(embed=embed)
|
||||
else:
|
||||
await ctx.send(content)
|
||||
except Exception as e:
|
||||
logger.error(f"Error sending response: {e}")
|
||||
logger.error(f"Error sending response in addnotes command: {e}")
|
||||
# Final fallback
|
||||
try:
|
||||
if embed:
|
||||
await ctx.send(embed=embed)
|
||||
elif content:
|
||||
await ctx.send(content)
|
||||
except Exception as fallback_error:
|
||||
logger.error(f"Fallback send also failed: {fallback_error}")
|
||||
# Fallback to regular send if followup fails
|
||||
try:
|
||||
if embed:
|
||||
|
||||
Reference in New Issue
Block a user