Author-Only Interactions

This article answers the frequently asked question "How do I make it so only the author can use button(s)/select menu(s)".

Adding `$authorID` to the `customID` (for buttons) or `value` (for select menus) fields makes it so you can check if the author is using the interaction or not with if statements.

Buttons Example

Using $addButton[]:

bot.commands.add({
  type: "basicCommand",
  name: "button",
  code: `$addActionRow
  Button!
  $addButton[button1_$authorID;Click Me OwO;primary]`
})

Replying to the Interaction:

bot.commands.add({
  type: "buttonCommand",
  code: `$if[$interactionID==button1_$authorID;$updateInteraction
Hello World!
;$if[$includes[$interactionID;button1]==true;:x: You're not the author of this button! $ephemeral;]]`
})

Select Menu Example

Using $addSelectMenu[]/$addSelectMenuOption[]:

Replying to the Interaction:

Last updated

Was this helpful?