Skip to content

Privacy model

Shardlens counts how many people use your bot, not who. In privacy mode (the default), user IDs never leave your bot process.

When an interaction arrives, the SDK replaces the user ID with:

h1:2026-11:3f9a1c… (version, salt period, 16 bytes of HMAC-SHA-256 as hex)
  • Keyed: the hash is an HMAC with a secret salt from the collector. Without the salt, nobody can check whether a hash belongs to a given user ID, which a plain hash of a Discord ID would allow.
  • Per period: each salt period (month by default; week or day are stricter) has its own salt, so the same user has unrelated hashes in different periods.
  • Truncated to 16 bytes, enough to count without collisions.

The collector creates a salt for each period and serves it to the SDK. Seven days after a period ends, its salt is destroyed: the secret is deleted and that period’s unique-user table is dropped. From then on, nobody (including you) can link those hashes back to a user, or link two periods together.

Your bot holds only the salts the collector currently serves: this period’s, the previous period’s until it is destroyed, and the next period’s in the last few minutes before it starts, so events at the boundary never wait. When the collector stops serving a salt, the bot forgets it at its next settings refresh, within the hour.

Salt period Unique users you can count Strictness
Month Daily, weekly and monthly Default
Week Daily and weekly Stricter
Day Daily only Strictest

Change the period in Settings → User identity.

  • Message content is never collected, and no privileged intents are needed. For prefix commands, your bot reports the command it matched; the SDK never reads the message.
  • Usernames, avatars and display names are never collected in privacy mode.
  • Option values are recorded only for options you allow-list, and secrets are redacted before anything is sent.
  • Bot tokens, interaction tokens, REST paths and request headers are never sent or logged. REST calls are recorded by bucketed route only (/channels/:id/messages).

Audit mode adds who ran each interaction, for support and abuse handling. It has to be switched on in both the SDK and the collector, is encrypted at rest, kept for at most 90 days, and every access is logged. It is read by a person signed in with Discord, or from your own dashboard’s server with an activity key that you create for it; read keys can’t read it.

Users can opt out or ask for erasure with the /privacy command. Opted-out users’ events are dropped inside your bot. Erasure drops the user’s events that are still waiting to be sent, then deletes their stored rows by hash for every period whose salt the bot holds. With a monthly or weekly salt that is every period that can still be linked to them. With a daily salt, the days before yesterday keep their rows until their salt is destroyed, a week after each day ends; from then on nobody can link those rows to the user. In audit mode the bot also sends the raw ID, and the collector erases every period whose salt still exists.

Rules 17 and 18 (no data brokers, no selling) hold because Shardlens is self-hosted and sends nothing to anyone but your collector. Shardlens has no telemetry of its own.

Discord user IDs are personal data, and pseudonymised data such as salted hashes is still personal data while the salt exists. As the bot owner you are the controller: publish a privacy policy (npx shardlens privacy prints a paragraph matching your setup) and record your lawful basis, usually legitimate interests for usage analytics. Shardlens helps with data minimisation, retention limits, opt-out and erasure.