This commit is contained in:
jjbrunton committed 2026-01-05 00:17:06 +00:00
1 parent b780bff850
commit 7b3ea37127
1752 files changed
+1341 -166

No files matched your search

+12 -3
View File
@@ -17,7 +17,7 @@ export class ResponseCheckerService {
private successfulMessagesRepo: SuccessfulMessagesRepository,
private postsRepo: PostsRepository,
private logger: Logger
) {}
) { }
async checkForResponses(): Promise<ResponseCheckResult[]> {
const results: ResponseCheckResult[] = [];
@@ -37,7 +37,7 @@ export class ResponseCheckerService {
// Navigate to inbox
try {
await this.page.goto('https://www.reddit.com/message/inbox/', {
waitUntil: 'networkidle',
waitUntil: 'domcontentloaded',
timeout: 30000,
});
@@ -45,6 +45,7 @@ export class ResponseCheckerService {
// Get all message threads/conversations
const conversations = await this.getInboxConversations();
this.logger.debug(`Found ${conversations.size} conversations in inbox`);
for (const message of uncheckedMessages) {
const result = await this.checkMessageResponse(message, conversations);
@@ -106,11 +107,14 @@ export class ResponseCheckerService {
const bodyEl = await item.$('.md, .message-body, [data-testid="message-body"]');
const snippet = bodyEl ? (await bodyEl.textContent())?.slice(0, 200) || '' : '';
this.logger.debug(`Checking inbox item from: ${cleanAuthor}, isReply: ${isReply}`);
if (isReply && cleanAuthor) {
conversations.set(cleanAuthor.toLowerCase(), {
hasReply: true,
snippet: snippet.trim(),
});
this.logger.info(`Found reply from ${cleanAuthor}`);
}
} catch {
// Skip problematic items
@@ -130,6 +134,8 @@ export class ResponseCheckerService {
const recipientLower = message.recipient.toLowerCase();
const conversation = conversations.get(recipientLower);
this.logger.debug(`Checking response for ${message.recipient} (key: ${recipientLower}) - Found: ${!!conversation}`);
if (conversation?.hasReply) {
return {
messageId: message.id,
@@ -151,8 +157,11 @@ export class ResponseCheckerService {
return successful.map((s) => {
let example = `Message: "${s.originalMessage}"`;
if (s.imageAnalysis) {
example = `Context (Image Analysis): "${s.imageAnalysis.slice(0, 300)}..."\n${example}`;
}
if (s.postTitle) {
example = `Post: "${s.postTitle}"\n${example}`;
example = `Post Title: "${s.postTitle}"\n${example}`;
}
return example;
});