diff --git a/bot.py b/bot.py index 8d7a1fe..b9516f8 100644 --- a/bot.py +++ b/bot.py @@ -5036,11 +5036,16 @@ async def warn(ctx, user: discord.User, reason: str = "No reason provided", mess try: if is_slash_command: # 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) 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: - 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") else: # 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: if is_slash_command: # 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) 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: - 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") else: # For prefix commands, we can't do true ephemeral, so log error instead