Files
RedditBot/src/web/types.ts
T

71 lines
1.9 KiB
TypeScript

export interface BotStats {
isRunning: boolean;
dryRunMode: boolean;
totalProcessed: number;
totalMessagesSent: number;
totalResponses: number;
responseRate: number;
messagesThisHour: number;
maxMessagesPerHour: number;
subreddits: { name: string; type: 'image' | 'chat' }[];
targetGenders: string[];
recentActivity: ActivityItem[];
accounts: Array<{
accountId: string;
redditUsername: string;
runtimeState: 'created' | 'starting' | 'running' | 'stopping' | 'stopped' | 'failed';
authenticated: boolean;
sendingState: 'ready' | 'bot-stopped' | 'runtime-stopped' | 'runtime-failed' | 'login-required' | 'matrix-cooldown' | 'replies-prioritized' | 'pacing';
messagesThisHour: number;
maxMessagesPerHour: number;
nextMessageAvailableAt: number | null;
hourlyResetAt: number;
messagesRemaining: number;
actionableReplies: number;
invitationCooldown: { until: number; reason: string; redditCode: string | null } | null;
failure: string | null;
}>;
/** Non-null when Reddit has throttled new DM invitations. */
invitationCooldown: {
until: number;
reason: string;
redditCode: string | null;
accountId?: string;
redditUsername?: string;
} | null;
}
export interface ActivityItem {
timestamp: number;
type: 'sent' | 'skipped' | 'response' | 'error' | 'info' | 'debug';
message: string;
recipient?: string;
imageUrl?: string;
postTitle?: string;
postUrl?: string;
owner?: { accountId: string; redditUsername: string };
}
export interface LogEntry {
timestamp: number;
level: 'info' | 'warn' | 'error' | 'debug';
message: string;
data?: unknown;
}
export interface RuntimeConfig {
rateLimit: {
minDelayBetweenMessagesMs: number;
maxMessagesPerHour: number;
jitterMs: number;
};
browser: {
dryRun: boolean;
};
reddit: {
prioritizeRecentPosts: boolean;
recentWindowMinutes: number;
maxReadyCandidates: number;
};
}