Nekopitsu
AI-powered Discord moderation
Nekopitsu is a public Discord bot written in C#/.NET for anime and otaku communities. Its hook is intelligent moderation: a tiered pipeline where classic filters resolve the obvious and a language model evaluates only the ambiguous cases —sarcasm, covert harassment, toxicity that uses no forbidden word— escalating according to the confidence of the analysis. On top of that it adds a character with a per-server configurable personality, community utilities and a web console, aiming to replace the typical stack of three or four bots with a single coherent product.
What it does
It turns server moderation into one product: the AI reads what pattern filters cannot, and every decision it makes is recorded as a case anyone on the mod team can review.
- Moderates with AI that weighs context and intent, escalating to the LLM only when classic filters are not enough.
- Manages cases, warnings and sanctions with escalation, audit logging and anti-spam / anti-raid protection.
- Takes on a per-server configurable personality through presets (neko, kawaii, tsundere, formal).
- Speaks Spanish and English natively, with localized slash commands.
- Allocates monthly AI analysis quotas per server under a freemium entitlement model.
- Adds community utilities: button and select autoroles, support tickets in private threads and on-demand temporary voice channels.
- Answers tickets with an AI first line anchored to a knowledge base, escalating to a person when it cannot resolve.
Architecture
The product guarantees —isolation between servers and no persistence of message content— are not left to code review: they are enforced by architecture tests that break the build.
- Real per-server multi-tenancy: the guild is the execution context, and a query that bypasses it breaks the build instead of passing review.
- Messages are analysed in transit with no content persistence: a test-enforced allow-list defines the only thing that may be stored.
- Tiered moderation pipeline with configurable confidence-based escalation, an asynchronous queue and graceful degradation if the AI provider goes down.
- AI provider abstraction over Ollama Cloud, replaceable without touching the product.
- Active/passive high availability with leader election through PostgreSQL advisory locks: two warm replicas and never two bots acting at once.
- Slash commands and interactive components only, with no prefix commands.
- In the agentic investigation flow, tools are checked against the live permission of whoever invokes them and evidence is compiled in memory: the system presents evidence, never verdicts, and a person carries out the sanction.
Stack
The bot is written in C# on .NET and persists to PostgreSQL running on Kubernetes. The web is two separate pieces: an administration console in Next.js with Discord login —configuration, case history and quota consumption— deployed alongside the bot, and a public landing built as a static Next.js 16 export with next-intl, served from the Cloudflare Workers edge with its own deployment cycle. AI analysis relies on open models served by Ollama Cloud.