Creating a personality quiz bot for Discord role assignment

Hey everyone! I’m pretty new to JavaScript but I want to build a Discord bot for my server. We have different groups or teams set up and I need something that works like those personality tests you see online.

Basically I want users to take a quiz and based on their answers they get assigned to one of three different teams. Each question would have multiple choice answers and each answer gives points to a specific team.

For example:
Team A, Team B, Team C

Sample question: “What do you value most?”

  1. Achievement (+1 Team A)
  2. Loyalty (+1 Team B)
  3. Adventure (+1 Team C)

After all questions are done, whichever team has the most points is where the user gets placed and they receive that team’s role automatically.

I’m thinking the bot could show questions in an embed and users click emoji reactions to choose their answers. Has anyone built something similar? Any tips on how to structure this would be awesome!

Built a similar quiz system last year - here’s what I learned the hard way. Put your questions and scoring in a separate config file instead of hardcoding. Trust me, updates are way easier later. For reactions, filter so only the person taking the quiz can respond to their session. Random users will screw up your scoring otherwise. Users will click whatever emoji they want, even when you clearly show the right ones. Handle invalid reactions gracefully or you’ll hate yourself later. Add a confirmation step before assigning roles, especially if teams have different channel access. Got tons of complaints when people landed somewhere unexpected and couldn’t get back to their usual channels.

Built something almost identical for my gaming server about 6 months ago. The biggest pain was stopping users from interfering with each other’s quiz sessions. Use a Map with user IDs as keys to track everyone’s progress and scores separately. Set timeouts around 30 seconds per question so it doesn’t hang forever when people bail halfway through. You’ll also need to decide what happens if someone already has a team role - remove the old one or block retakes completely? Pro tip: check that your bot can actually manage roles before starting the quiz. Nothing worse than users finishing everything just to hit a permissions error at the end.

Sounds like a fun project! You could use discord.js for this. Try saving your quiz data in an object or JSON. Use message.awaitReactions() for collecting answers. And yeah, don’t forget to plan for ties—maybe add a quick tiebreaker question!