Skip to content
Advertisement

DiscordJS filtering users from buttons and limiting buttons to user who used command

I’m trying to make a bot that lets users create embeds using a series of commands and its going well. But I encountered a problem, the bot uses buttons but to confirm something like “Are you sure this is your title?” any user can click the button; which is a problem. I only want the user who used the command to be able to use the buttons.

Here is what I tried at the start:

JavaScript

I tried to use interaction.user.id != or === interaction.message.author.id but that doesn’t work

Advertisement

Answer

The best way to make a button only for a single user is to put the user ID in the custom ID

For example, set the ID to title-${interaction.user.id}

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement