UNPKG

@aituber-onair/kizuna

Version:

A sophisticated bond system (絆 - Kizuna) for managing relationships between users and AI characters in AITuber OnAir.

114 lines (113 loc) 2.69 kB
/** * KizunaManager - Main class for the Kizuna system * * Manages relationships with users and controls the point system */ import type { KizunaConfig, KizunaUser, PointContext, PointResult, PointRule, KizunaManagerInterface, StorageProvider } from "./types"; /** * Basic implementation of event emitter */ declare class EventEmitter { private listeners; on(event: string, listener: (...args: unknown[]) => void): void; off(event: string, listener: (...args: unknown[]) => void): void; emit(event: string, data?: unknown): void; removeAllListeners(): void; } /** * Main manager class for the Kizuna system */ export declare class KizunaManager extends EventEmitter implements KizunaManagerInterface { private config; private users; private storageProvider; private isInitialized; private pointCalculator; private storageKey; constructor(config: KizunaConfig, storageProvider?: StorageProvider, storageKey?: string); /** * Initialization process */ initialize(): Promise<void>; /** * Interaction processing - Main point calculation logic */ processInteraction(context: PointContext): Promise<PointResult>; /** * Get user */ getUser(userId: string): KizunaUser | null; /** * Get all users */ getAllUsers(): KizunaUser[]; /** * Add points */ addPoints(userId: string, points: number, context?: PointContext, appliedRules?: PointRule[]): Promise<PointResult>; /** * Calculate level */ calculateLevel(points: number): number; /** * Get statistics */ getStats(): Record<string, unknown>; /** * Get or create user */ private getOrCreateUser; /** * Create new user */ private createUser; /** * Determine user type */ private determineUserType; /** * Extract display name from user ID */ private extractDisplayName; /** * Calculate points */ private calculatePoints; /** * Check thresholds (temporary implementation) */ private checkThresholds; /** * Add interaction record */ private addInteractionRecord; /** * Load data from storage */ private loadFromStorage; /** * Save data to storage */ private saveToStorage; /** * Set up automatic cleanup */ private setupAutoCleanup; /** * Perform data cleanup */ private performCleanup; /** * Emit event */ private emitEvent; /** * Log output */ private log; /** * Check log level */ private shouldLog; } export {};