Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

discord.py – How can i make a slash command's response only visible to me?

small question.
How can i make a slash command only visible to me?
photo:example

Literally searched the internet for 10 minutes and found NO answer. The only thing i found was how to make a slash command. Does anyone know how to do this? thanks.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

@bot.tree.command(name="something")
async def something(interaction:discord.Interaction):
    await interaction.response.send_message("NOTHING",ephemeral=True)
    # optional (if you want to edit the response later,delete it, or send a followup)
    await interaction.edit_original_response(content="Something")
    await interaction.followup.send("This is a message too.",ephemeral=True)
    await interaction.delete_original_response()
    # if you have deleted the original response you can't edit it or send a followup after it

And these are the basics. If you don’t know how to load the commands:

@bot.event
async def on_ready():
    print("Bot is online!")
    try:
        synced = await bot.tree.sync()
        print(f"Synced {len(synced)} commands.")
    except Exception as e:
        print(e)

All set! Good luck with coding. If you need further help my discord is @rexy.py

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading