From c286c2a070a6408494538b8e499055468ed2622a Mon Sep 17 00:00:00 2001 From: neoarz Date: Fri, 17 Oct 2025 23:35:29 -0400 Subject: [PATCH] refactory(say): now works in dms and priv channels --- cogs/owner/say.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/cogs/owner/say.py b/cogs/owner/say.py index 8f3899e..a2ae0a9 100644 --- a/cogs/owner/say.py +++ b/cogs/owner/say.py @@ -47,12 +47,17 @@ class Say(commands.Cog, name="say"): interaction = getattr(context, "interaction", None) if interaction is not None: - await interaction.response.defer(ephemeral=True) - await context.channel.send(message, allowed_mentions=allowed_mentions) + is_in_guild = context.guild is not None + await interaction.response.defer(ephemeral=is_in_guild) try: - await interaction.delete_original_response() - except: - pass + await context.channel.send(message, allowed_mentions=allowed_mentions) + if is_in_guild: + try: + await interaction.delete_original_response() + except: + pass + except discord.Forbidden: + await interaction.followup.send(message, allowed_mentions=allowed_mentions) else: try: await context.message.delete() @@ -94,12 +99,17 @@ class Say(commands.Cog, name="say"): interaction = getattr(context, "interaction", None) if interaction is not None: - await interaction.response.defer(ephemeral=True) - await context.channel.send(embed=embed, allowed_mentions=allowed_mentions) + is_in_guild = context.guild is not None + await interaction.response.defer(ephemeral=is_in_guild) try: - await interaction.delete_original_response() - except: - pass + await context.channel.send(embed=embed, allowed_mentions=allowed_mentions) + if is_in_guild: + try: + await interaction.delete_original_response() + except: + pass + except discord.Forbidden: + await interaction.followup.send(embed=embed, allowed_mentions=allowed_mentions) else: try: await context.message.delete()