modified: bot.py

This commit is contained in:
SimolZimol
2025-11-07 22:49:15 +01:00
parent acb5216bc5
commit 9bc222659d

18
bot.py
View File

@@ -5036,11 +5036,16 @@ async def warn(ctx, user: discord.User, reason: str = "No reason provided", mess
try: try:
if is_slash_command: if is_slash_command:
# Since we deferred with ephemeral=silent, use followup # Since we deferred with ephemeral=silent, use followup
if hasattr(ctx, 'followup') and ctx.followup: # Make sure followup is available and properly initialized
if hasattr(ctx, 'followup') and ctx.followup is not None:
await ctx.followup.send(embed=silent_embed, ephemeral=True) await ctx.followup.send(embed=silent_embed, ephemeral=True)
logger.info(f"Silent warning sent via ctx.followup.send (ephemeral)") logger.info(f"Silent warning sent via ctx.followup.send (ephemeral)")
elif hasattr(ctx, 'interaction') and ctx.interaction:
# Direct interaction followup as fallback
await ctx.interaction.followup.send(embed=silent_embed, ephemeral=True)
logger.info(f"Silent warning sent via ctx.interaction.followup.send (ephemeral)")
else: else:
logger.error(f"Silent warning failed: No followup available after defer") logger.error(f"Silent warning failed: No followup available - ctx.followup: {getattr(ctx, 'followup', None)}")
raise Exception("No followup available after defer") raise Exception("No followup available after defer")
else: else:
# For prefix commands, we can't do true ephemeral, so log error instead # For prefix commands, we can't do true ephemeral, so log error instead
@@ -6634,11 +6639,16 @@ async def mute(ctx, user: discord.User, duration: str, reason: str = "No reason
try: try:
if is_slash_command: if is_slash_command:
# Since we deferred with ephemeral=silent, use followup # Since we deferred with ephemeral=silent, use followup
if hasattr(ctx, 'followup') and ctx.followup: # Make sure followup is available and properly initialized
if hasattr(ctx, 'followup') and ctx.followup is not None:
await ctx.followup.send(embed=silent_embed, ephemeral=True) await ctx.followup.send(embed=silent_embed, ephemeral=True)
logger.info(f"Silent mute sent via ctx.followup.send (ephemeral)") logger.info(f"Silent mute sent via ctx.followup.send (ephemeral)")
elif hasattr(ctx, 'interaction') and ctx.interaction:
# Direct interaction followup as fallback
await ctx.interaction.followup.send(embed=silent_embed, ephemeral=True)
logger.info(f"Silent mute sent via ctx.interaction.followup.send (ephemeral)")
else: else:
logger.error(f"Silent mute failed: No followup available after defer") logger.error(f"Silent mute failed: No followup available - ctx.followup: {getattr(ctx, 'followup', None)}")
raise Exception("No followup available after defer") raise Exception("No followup available after defer")
else: else:
# For prefix commands, we can't do true ephemeral, so log error instead # For prefix commands, we can't do true ephemeral, so log error instead