mirror of
https://github.com/bradganley/bsky-user-activity-bot.git
synced 2024-12-23 18:57:15 +00:00
archive post by posting text with quote
This commit is contained in:
parent
cbb076fa1c
commit
f6c3a7eef2
30
src/index.ts
30
src/index.ts
@ -41,12 +41,23 @@ let handlers = {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
[ActionTakenByUserValidator.make(<string>Bun.env.USER_DID)],
|
[ActionTakenByUserValidator.make(<string>Bun.env.USER_DID)],
|
||||||
[
|
[
|
||||||
CreateSkeetAction.make("Aaron posted:", undefined, (handler: HandlerAgent, commit: JetstreamEventCommit): JetstreamSubject =>{
|
CreateSkeetAction.make(
|
||||||
return {
|
(handler: HandlerAgent, commit: JetstreamEventCommit): string => {
|
||||||
cid: MessageHandler.getCidFromMessage(handler, commit),
|
// @ts-ignore
|
||||||
uri: MessageHandler.getUriFromMessage(handler, commit)
|
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")
|
LogInputTextAction.make("Post")
|
||||||
],
|
],
|
||||||
testAgent
|
testAgent
|
||||||
@ -59,7 +70,7 @@ let handlers = {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
[ActionTakenByUserValidator.make(<string>Bun.env.USER_DID)],
|
[ActionTakenByUserValidator.make(<string>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;
|
return commit.commit.record.subject as JetstreamSubject;
|
||||||
}),
|
}),
|
||||||
LogInputTextAction.make("Like")
|
LogInputTextAction.make("Like")
|
||||||
@ -74,7 +85,7 @@ let handlers = {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
[ActionTakenByUserValidator.make(<string>Bun.env.USER_DID)],
|
[ActionTakenByUserValidator.make(<string>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;
|
return commit.commit.record.subject as JetstreamSubject;
|
||||||
}),
|
}),
|
||||||
LogInputTextAction.make("Repost")
|
LogInputTextAction.make("Repost")
|
||||||
@ -104,7 +115,6 @@ let handlers = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function initialize() {
|
async function initialize() {
|
||||||
await testAgent.authenticate()
|
await testAgent.authenticate()
|
||||||
jetstreamSubscription = new JetstreamSubscription(
|
jetstreamSubscription = new JetstreamSubscription(
|
||||||
@ -114,7 +124,7 @@ async function initialize() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize().then(() =>{
|
initialize().then(() => {
|
||||||
jetstreamSubscription.createSubscription()
|
jetstreamSubscription.createSubscription()
|
||||||
DebugLog.info("INIT", 'Initialized!')
|
DebugLog.info("INIT", 'Initialized!')
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user