From f6c3a7eef2792d5a0e83a8549ddf31a4330f97e7 Mon Sep 17 00:00:00 2001 From: Juni Date: Wed, 11 Dec 2024 19:29:15 -0600 Subject: [PATCH] archive post by posting text with quote --- src/index.ts | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/index.ts b/src/index.ts index bd1d841..1f69c7e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -41,12 +41,23 @@ let handlers = { // @ts-ignore [ActionTakenByUserValidator.make(Bun.env.USER_DID)], [ - CreateSkeetAction.make("Aaron posted:", undefined, (handler: HandlerAgent, commit: JetstreamEventCommit): JetstreamSubject =>{ - return { - cid: MessageHandler.getCidFromMessage(handler, commit), - uri: MessageHandler.getUriFromMessage(handler, commit) - } - }), + CreateSkeetAction.make( + (handler: HandlerAgent, commit: JetstreamEventCommit): string => { + // @ts-ignore + let text = "\"" + commit.commit.record?.text + "\""; + if(text.length > 300){ + text = text.substring(1, 301) + } + return text; + }, + undefined, + (handler: HandlerAgent, commit: JetstreamEventCommit): JetstreamSubject => { + return { + cid: MessageHandler.getCidFromMessage(handler, commit), + uri: MessageHandler.getUriFromMessage(handler, commit) + } + }), + LogInputTextAction.make("Post") ], testAgent @@ -59,7 +70,7 @@ let handlers = { // @ts-ignore [ActionTakenByUserValidator.make(Bun.env.USER_DID)], [ - CreateSkeetAction.make("Aaron liked:", undefined, (handler: HandlerAgent, commit: JetstreamEventCommit): JetstreamSubject =>{ + CreateSkeetAction.make("Aaron liked:", undefined, (handler: HandlerAgent, commit: JetstreamEventCommit): JetstreamSubject => { return commit.commit.record.subject as JetstreamSubject; }), LogInputTextAction.make("Like") @@ -74,7 +85,7 @@ let handlers = { // @ts-ignore [ActionTakenByUserValidator.make(Bun.env.USER_DID)], [ - CreateSkeetAction.make("Aaron reposted:", undefined, (handler: HandlerAgent, commit: JetstreamEventCommit): JetstreamSubject =>{ + CreateSkeetAction.make("Aaron reposted:", undefined, (handler: HandlerAgent, commit: JetstreamEventCommit): JetstreamSubject => { return commit.commit.record.subject as JetstreamSubject; }), LogInputTextAction.make("Repost") @@ -104,7 +115,6 @@ let handlers = { } - async function initialize() { await testAgent.authenticate() jetstreamSubscription = new JetstreamSubscription( @@ -114,7 +124,7 @@ async function initialize() { ); } -initialize().then(() =>{ +initialize().then(() => { jetstreamSubscription.createSubscription() DebugLog.info("INIT", 'Initialized!') });