#Test for multiple interactions

6 messages · Page 1 of 1 (latest)

broken scarab
#

Is there a way to check if a user has multiple interactions?

trail scrollBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

little tulip
#

If you absolutely need this (interested what the use-case is) you‘d need to store the ids of users that start an interaction and remove them from that set/collection when the interaction completed

broken scarab
#
const userId = interaction.user.id;
const interactingUsers = new Map<string, boolean>();

if (interactingUsers.has(userId)) {
    await interaction.followUp("You already have one open interaction!");
    return;
}

interactingUsers.set(userId, true);

//Code...

interactingUsers.delete(userId);
#

do you mean something like this @little tulip?

little tulip
#

Something like that, but you‘d need to declare that Map outside of that function of course, else it‘ll always be empty when you check