#defer ephemeral?

1 messages · Page 1 of 1 (latest)

brisk bone
#
from disnake.ext import commands
import disnake


class CooldownCog(commands.Cog):
    def __init__(self, bot: commands.Bot):
        self.bot = bot

    @commands.Cog.listener(name="on_slash_command_error")
    async def slash_command_on_cooldown(self,
                                        inter: disnake.ApplicationCommandInteraction,
                                        error: commands.CommandError):
        if isinstance(error, commands.CommandOnCooldown):
            # await inter.delete_original_response()
            await inter.send(str(error))


def setup(bot: commands.Bot):
    bot.add_cog(CooldownCog(bot))

I have this code to respond to a user if a command is in cooldown. It is guaranteed that there was an inter.response.defer() before it, but unknown ephemeral. I need to get a boolean ephemeral to modify or delete and send the response.

brisk bone
#

my solve:

#
print((await inter.original_response()).flags.ephemeral)
grand zenithBOT
#
Solved!

Marked the thread as solved. If your question has not been answered, please open a new thread in #1019642966526140566.

west needle
#

compare with

#

-d disnake.InteractionResponseType

pine valveBOT
west needle
#

if it's any of the types that start with deferred_, you'll know the interaction was deferred

brisk bone
west needle
#

oh fuck, yeah, my bad

#

hmm, this'd be a lot easier if we supported custom interaction classes