Skip to content

@web-engine-dev/moderation

Content and user moderation system for multiplayer games.

Features

  • Content Filtering: Profanity and toxicity detection
  • User Reporting: Player report handling
  • Bans/Mutes: Punishment management
  • Appeal System: Ban appeal workflow
  • Audit Logs: Moderation action logging

Installation

bash
npm install @web-engine-dev/moderation
# or
pnpm add @web-engine-dev/moderation

Quick Start

typescript
import { ModerationService, ContentFilter } from '@web-engine-dev/moderation';

// Initialize
const moderation = new ModerationService({
  apiUrl: 'https://api.platform.com/moderation',
});

// Filter content
const result = await moderation.filterContent(message);
if (result.blocked) {
  console.log('Message blocked:', result.reason);
}

// Report user
await moderation.reportUser({
  reporter: currentUser.id,
  reported: offendingUser.id,
  reason: 'harassment',
  evidence: chatLog,
});

API Overview

Content Filtering

typescript
const filter = new ContentFilter({
  profanityFilter: true,
  toxicityThreshold: 0.7,
  customBadWords: ['badword'],
  allowlist: ['allowed'],
});

const result = await filter.check(text);
console.log(result.clean); // Filtered text
console.log(result.flagged); // Was flagged
console.log(result.reasons); // Why flagged
console.log(result.severity); // Severity level

User Reports

typescript
// Submit report
await moderation.reportUser({
  reporter: userId,
  reported: badUserId,
  reason: 'cheating',
  evidence: {
    type: 'screenshot',
    url: 'https://...',
  },
  context: {
    gameId: gameId,
    matchId: matchId,
  },
});

// Get report status
const report = await moderation.getReport(reportId);

Punishments

typescript
// Ban user
await moderation.banUser(userId, {
  duration: 7 * 24 * 60 * 60, // 7 days
  reason: 'repeated harassment',
  notifyUser: true,
});

// Mute user
await moderation.muteUser(userId, {
  duration: 60 * 60, // 1 hour
  scope: 'chat',
});

// Check status
const status = await moderation.getUserStatus(userId);
console.log(status.isBanned);
console.log(status.isMuted);
console.log(status.banExpires);

Appeals

typescript
// Submit appeal
await moderation.submitAppeal({
  punishmentId: punishmentId,
  reason: 'It was a misunderstanding...',
});

// Get appeal status
const appeal = await moderation.getAppeal(appealId);

Proprietary software. All rights reserved.