#Only allow to interact with our own dashboards

7 messages · Page 1 of 1 (latest)

carmine rock

I want to disallow others from interacting with a interaction that they do not own/did not create themselves.

I am inspired by this bot: Dank meme bot:
It does something kind of cool where when someone else tries to interact with my dashboard, it just simply tells them that they are not the original poster/This is not for you

I have tried getting the interaction.id, but this is a new id for every interaction.

I cannot realy wrap my head around how to solve this...
Anyone got any ideas?

I uploaded a image of how it looks when i try to interct with someone else's dashboard in the Dank Memer bot

high thunderBOT
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
carmine rock

This is an example of code that I would like to be able to add the functionality to:

async function dashboard(interaction) {
   
    const btn = new ButtonBuilder()
        .setCustomId('Button')
        .setLabel('Button')
        .setStyle(ButtonStyle.Secondary);


    const dashboard = new ActionRowBuilder().addComponents(btn);

    await interaction.editReply({
        content: 'This is your dashboard',
        components: [row],
        ephemeral: false,
    });
}

module.exports = { dashboard };

The idea beeing that when the 'Button' interaction is called I would want to check if the user is the one that send the original message, but I dont see a way to get the original poster

hoary marlin

Dank uses the reference from my understanding:

//using interaction data 
const userIdFromReference = interaction.message.interaction.user.id;
const userId = interaction.user.id;
if(userIdFromReference !== userId) return interaction.reply("This is not yours");

That's wrong hold on (fixed)