AI Moderation

Overview

Lillo provides a robust foundation for community moderation through a role-based permission system and administrative tools. The current implementation focuses on essential moderation capabilities, with planned expansions to enhance community management features.

Role-Based Permissions

Role Hierarchy

export enum AdminRole {
  USER = 'user',           // Regular user
  MODERATOR = 'moderator', // Can delete messages
  ADMIN = 'admin',         // Can manage users
  OWNER = 'owner'          // Can change group info
}

Permission Levels

  • Owner: Full system access and configuration

  • Admin: User management and data access

  • Moderator: Message moderation and content control

  • User: Standard access to bot features

Administrative Commands

Data Management

/admin users   - Export user data
/admin posts   - Export post history
/admin chat    - Export chat history
/admin clear   - Clear database records

Implementation Details

  • Role-based access control

  • Command validation

  • Audit logging

  • Error handling

  • Rate limiting

Security Features

Role Verification

const hasPermission = await hasRequiredRoleCached(
  userId, 
  AdminRole.ADMIN
);

Caching System

  • 5-minute role cache

  • Reduced API calls

  • Quick permission checks

  • Automatic cache invalidation

Data Export Tools

Available Formats

  • JSON export for detailed analysis

  • CSV export for spreadsheet compatibility

  • Configurable field selection

  • Data sanitization

Export Categories

  • User data and metrics

  • Post history and analytics

  • Chat logs and interactions

  • Command usage statistics

Future Enhancements

The moderation system is actively being developed with planned features including:

  • Enhanced user management tools

  • Advanced content filtering

  • Automated moderation rules

  • Community guidelines enforcement

  • Detailed audit logs

  • Moderation team collaboration tools

Best Practices

Command Usage

  • Verify permissions before execution

  • Log all administrative actions

  • Handle errors gracefully

  • Provide clear user feedback

Data Management

  • Regular backups

  • Secure data handling

  • Privacy compliance

  • Audit trail maintenance

Last updated