.NET (C#) SDK — Moderation

The local TextFilter gives an instant offline verdict from the embedded hashed wordlist; censor() is the authoritative server check and also returns the masked display text. A missed local flag still fails server-side.

Moderation

Moderation.CensorAsync
public static Task<CensorResponse> CensorAsync(
    Client client,
    string text,
    CancellationToken ct = default
)

Calls POST /api/censor.php — the authoritative server check (max 1000 characters). CensorResponse exposes Clean, Filtered (masked, display-safe text) and RetryAfter on a 429 reply.

Example Usage:

var result = await Moderation.CensorAsync(client, chatText);
if (!result.Clean)
    ShowMessage(result.Filtered);  // masked, safe to display
TextFilter — local checks
TextFilter.IsClean(text)
TextFilter.Filter(text)
TextFilter.IsNameAllowed(name)
TextFilter.FilterName(name, "Player")

Instant offline screening using the embedded salted-hash data — no request needed. The server stays authoritative: a missed local flag still fails server-side.

Local filter, server verdict

Censor is the authoritative moderation call: it returns the server-side profanity verdict — and the masked text — for names, lobby titles and chat-class strings. The matcher normalizes case, compatibility forms, confusable characters, digit lookalikes and repeated runs, so obfuscated spellings still match before the verdict comes back.

The server already screens automatically at registration, rename and room creation — censor exists for surfaces the server never sees, like free-form chat or pre-submit feedback. SDKs also ship a local TextFilter built from the same wordlist for instant offline checks; a miss locally still fails server-side, so never treat a local pass as final.

  • Apply the check to every user-visible string — player names, room titles, chat — not just account names.
  • The verdict returns masked display text as well as the decision, for surfaces that filter rather than reject.
  • Name and room rules are separate from profanity — both apply server-side at the same endpoints.
  • Methods are Task-based async — await them and pass a CancellationToken tied to your game's lifetime so in-flight requests cancel cleanly on shutdown.