#How do I check if the user ID is actually equals to the user ID in interaction-handlers
1 messages · Page 1 of 1 (latest)
You can pass the user ID through the customId and get it that way
return interaction.customId.startsWith("test_button_") ? this.some(interaction.customId.split("_")[2]) : this.none();
That would be your parse function in the interaction handler
You only need 1 users ID
interaction.user.id is the person who pressed the button or whatever
The ID from your customId is the person who originally executed the command
well for this instance, I'm including another ID for a member arg
like >cmd @mem
so
im adding that as well
Well, then yeah, should return them as an object in the this.some()
well so far seems like mine is working
import { InteractionHandlerTypes } from '@sapphire/framework';
import { InteractionHandler } from '@sapphire/framework';
import type { ButtonInteraction } from 'discord.js';
export class WipeCommandAcceptButton extends InteractionHandler {
public constructor(context: InteractionHandler.Context) {
super(context, {
name: 'WipeCommandAcceptButton',
interactionHandlerType: InteractionHandlerTypes.Button,
});
}
public override parse(interaction: ButtonInteraction) {
return !interaction.customId.startsWith(
`${interaction.user.id}-wipe-accept`,
)
? this.none()
: this.some();
}
public run(interaction: ButtonInteraction) {
return interaction.reply(`ok ${interaction.user} ran this button`);
}
}
ya i think thisll be it

Why are you checking if it starts with the interaction.user.id (person pressing the button)

I'm just gonna take myself out of this thread, this has just brainfucked me