Clear slash command in discord.py

Viewed 44

At the beginning I would like to point out that I do not use the py-cord module only and only discord.py. I wanted to create a / clear command.The problem is when the application that has to return the feedback that successfully deleted n messages from the user xyz.

There is an error mentioning

"await interaction.response.send_message (content = content, ephemeral = True)"

is an unknown interaction

All code slash command:

client = MyClient(intents=intents)
t = app_commands.CommandTree(client)

@t.command(name="clear", description="Clear n messages specific user", guild=discord.Object(id=867851000286806016))
async def self(interaction: discord.Interaction, amount: int, member: discord.Member):
    channel = interaction.channel

    def check_author(m):
        return m.author.id == member.id
    await channel.purge(limit=amount, check=check_author)
    content = f"Successfully deleted {amount} messages from {member.name}"
    await interaction.response.send_message(content=content, ephemeral=True)
client.run(discord_TOKEN)

At the end, I wanted to point out that the bot removes the number of messages that were given. Only feedback from the bot application is missing.

I have the message: The application is not responding

1 Answers

def check_author(m): should be async.

Related