How it works
- A member runs a slash command, presses a button or submits a form.
- A member on the shared blacklist is refused first, so a refused interaction creates no row. Bots are skipped too, or every bot that triggered an interaction would get a row.
- The member’s Discord username is fetched by their Discord id. If they have no row yet, one is created with that name. If the name changed since, the row is updated.
- The command runs and can rely on the row existing.
Database model
User.id, not to the Discord id.
Key functions
ensureUserExists(discordId)fetches the username, creates or updates the row and returns it.getUserByDiscordId(discordId)returns the row without creating one.