Pause automation after manual Reddit replies

This commit is contained in:
jjbrunton committed 2026-08-09 19:30:16 +01:00
1 parent bf474dfe10
commit 84a133451f
5 files changed
+175 -6

No files matched your search

+16 -1
View File
@@ -14,6 +14,13 @@ export interface MediaExchangeChat {
sendChatMessage(roomId: string, message: string, txnId?: string): Promise<boolean>;
}
export interface MediaExchangeOutboundAttribution {
eventIds: string[];
texts: string[];
}
const RECIPROCAL_MESSAGE = 'Your turn — send me one back if you’re comfortable.';
export type MediaExchangeResult =
| { kind: 'not-requested' }
| { kind: 'dry-run'; requestKind: MediaRequestKind }
@@ -40,6 +47,14 @@ export class MediaLibraryExchangeService {
);
}
getOutboundAttribution(conversationId: string): MediaExchangeOutboundAttribution {
const sends = this.repository.listConversationSends(this.accountId, conversationId);
return {
eventIds: sends.flatMap((send) => send.matrixMediaEventId ? [send.matrixMediaEventId] : []),
texts: sends.flatMap((send) => send.matrixTextEventId ? [RECIPROCAL_MESSAGE] : []),
};
}
async handle(
conversationId: string,
incomingKey: string,
@@ -103,7 +118,7 @@ export class MediaLibraryExchangeService {
? true
: await this.chat.sendChatMessage(
conversationId,
'Your turn — send me one back if you’re comfortable.',
RECIPROCAL_MESSAGE,
`rbot-library-reciprocal-${send.id}`,
);
if (!textSent) {