Skip to content

Trainer Directory

Hails edited this page Jun 18, 2026 · 9 revisions

Trainer Directory

The Trainers page at /trainers has two tabs: the Directory, an opt-in public listing of the community's trainers, and the Raid Finder for organizing remote raids (covered on its own page, Raid-Finder). This page covers the Directory tab.

What a trainer card shows

Every listed trainer gets a card in the directory grid. Depending on what the trainer has filled in and made public, a card can include:

  • Trainer name -- the public profile name (the site username is shown instead when no public profile is set, marked with an asterisk)
  • Trainer code -- the friend code, formatted for readability and copyable; codes are only visible to logged in viewers
  • Avatar -- a trainer class sprite chosen in Settings, from two collections: classic trainer classes served via Pokemon Showdown's sprite set (Youngster, Lass, Ace Trainer, and friends) and GBA style sprites from the open source Dreamstone Mysteries project
  • Pronouns and location (region and country, shown only at the precision the trainer chose)
  • Favorite Pokemon sprite, including a shadow styling for shadow forms
  • Raid rank badge -- earned through Raid Finder XP
  • Staff badges -- a crown for the Owner, a gem for Admins, a medal for Moderators, and a test tube for Testers, plus special ranks: a check mark for Trusted users and a clapperboard for Content Creators (see Trust-and-Awards)
  • Tags -- colored labels assigned by staff
  • Supporter indicators -- a DONATOR badge and a rainbow name for supporters
  • Online dot -- shown when the trainer has been active in the last five minutes; online trainers sort first
  • My Collection -- a link at the bottom of the profile modal that expands inline to show the trainer's shiny collection; each entry shows the shiny sprite, Pokemon name, a Shadow or Purified badge where applicable, and the capture method (omitted when Any method); only shown when the trainer's profile is public and they have not hidden their collection (see Privacy below)

A search box filters the grid live, and clicking a card opens a profile modal with the full details.

How to appear in the directory

  1. Create an account and log in (Accounts-and-Roles).
  2. Open Settings and set your trainer name and trainer code; pick an avatar, pronouns, location, and favorite Pokemon if you like.
  3. Make your profile public. Until you do, only your username appears, marked with an asterisk, and no profile details are shown.

Privacy is granular: location display precision is your choice, trainer codes are hidden from logged out visitors, and every profile field is withheld unless your profile is public. A separate Hide shiny collection toggle (also in Settings) prevents your caught shinies from appearing on your trainer card without affecting the rest of your public profile. Staff can hide an account from the directory entirely (a moderation control, see Admin-Guide); disabled accounts never appear.

Under the hood

The page is the templates/trainers.html template, rendered server side by TrainersPage in internal/handlers/trainers.go. The handler queries all users with directory_hidden = 0 AND disabled = 0, resolves each avatar slug to its sprite URL through the trainer class catalog, computes the raid rank from raid XP, and derives online status from last_seen_at within the last five minutes. Cards are emitted as HTML with data- attributes carrying the profile fields; a small inline script drives the search filter and the profile modal from those attributes, so no extra API call is needed to open a card.

The shiny collection inside the modal is loaded lazily: clicking My Collection triggers a GET /api/shinies/of/{username} fetch. The endpoint returns an empty array for private profiles or when shinies_hidden = 1; it includes pre-resolved shiny sprite URLs so the display does not need a separate data lookup.

Favorite Pokemon sprites come from the PokeAPI sprite repository, and avatar sprites are cached and served through a local sprite proxy rather than hotlinking the upstream CDNs. The Raid Finder tab on the same page is powered by the static/js/raidfinder.js bundle; the two tabs share the page but not their code.

Clone this wiki locally